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.

    <script
    src="https://decisely-dpc.s3-us-west-2.amazonaws.com/cdn/1-mdb-pro-4.14.1.min.js">>> </script>
   </body>

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', ->
$('.button-collapse').sideNav()

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.

FREE CONSULTATION

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

Status

Opened

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