Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Run a script on collapsing an accordion (to clear a number of variables)

AJEsler2019 priority asked 4 years ago


Expected behavior

I expect a script to run when I collapse an accordion (#myCollapsible) refers to

Actual behavior

The script does not run. I have it within the document.ready function. I am uncertain of which div in the actual accordion that the example javascript. I have tried using a test id tag in all the divs with no success.

The browser console has the following error with the line of code referencing the script below

Uncaught TypeError: $(...).on(...) is not a function

Resources (screenshots, code snippets etc.)

$('#myCollapsible').on('hidden.bs.collapse') function () {my code} );


AJEsler2019 priority commented 4 years ago

Just saw my error. Code should read (comma replaces bracket): $('#myCollapsible').on('hidden.bs.collapse', function () {my code} );


Grzegorz Bujański staff commented 4 years ago

Hi. I'm glad you were able to solve the problem. Best, Grzegorz



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: 4.17.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No