Topic: sideNav is undefined

jimscottjr free asked 4 years ago

Expected behavior No TypeError when JS for $(".button-collapse").sideNav() is called

Actual behavior

TypeError: $('.button-collapse').sideNav is not a function. (In '$('.button-collapse').sideNav()', '$('.button-collapse').sideNav' is undefined)

Resources (screenshots, code snippets etc.)

APP: Rails application, ver 5.2.3, ruby 2.6.3. Loading MDB-pro JS at the last item of the body tag.

    src="">>> </script>

HTML: SideNav called on page as:

<a href="#" data-activates="slide-out" class="button-collapse"><i class="menu-bars fas fa-bars"></i></a>

JS: Using CoffeeScript

Called from

 $(document).on 'turbolinks:load', ->

Grzegorz Bujański staff commented 4 years ago

Hi. is your cofeeScript code is equivalent to JavaScript document ready function? sideNav should been called inside document ready function.

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.14.0
  • Device: Macbook Pro
  • Browser: both Safari and Chrome
  • OS: macOS ctalina 10.15.2
  • Provided sample code: No
  • Provided link: No