jbstevens6 free asked 5 years ago

I'm trying to get a 'onSwitchChange' type of event working. I tried this: $(".switch").click(function () { alert('test'); }); But that did not seem to work. Is there a good way to hook into MDB's switch inputs in order to fire off an ajax call when the user changes the switch?

Try this code:
$('.switch input[type="checkbox"]').on('change', function() {
    console.log('Yaay, I was changed');

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

  • User: Free
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No