$('.button-collapse').sideNav is not a function


Topic: $('.button-collapse').sideNav is not a function

jimscottjr pro premium asked 6 months ago

*Expected behavior*Expect sideNav to be a function

Actual behavior$('.button-collapse').sideNav is not a function when page is loaded

*Resources (screenshots, code snippets etc.)*JS loaded just prior to body close:


Mateusz Łubianka staff answered 6 months ago

Hi @jimscottjr,

Did you initialize sidenav function inside the $( document ).ready() function? It should work if you use:

$(document).ready(function() {
    $(".button-collapse").sideNav();
});

Best,


Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: jQuery
  • MDB Version: 4.12.0
  • Device: Macbook Pro
  • Browser: both Safari and Chrome
  • OS: macOS ctalina 10.15.2
  • Provided sample code: No
  • Provided link: No