Topic: Switch - click/change event
jbstevens6 free asked 7 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?
Add comment
Bartłomiej Malanowski staff answered 7 years ago
Try this code:
$('.switch input[type="checkbox"]').on('change', function() {
console.log('Yaay, I was changed');
});
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Specification of the issue
- ForumUser: Free
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Tags