I use this codes for checkbox checked event but it does not work.
css
This work for me.
$(".switch").bootstrapSwitch({
'size': 'mini',
'onSwitchChange': function(event, state){
console.log('switched...')
},
'AnotherName':'AnotherValue'
});
Note: The bootstrap docs now use the second example.
For bootstrap-switch 3.0 release candidate the event previously given as an example on the official page was:
$('#switch-change').on('switchChange', function (e, data) {});
It doesn't get fired!
Solution - use this instead :
$('#switch-change').on('switchChange.bootstrapSwitch', function (event, state) {});
where state
parameter is the value of the checkbox
.
this worked for while using bootstrapSwitch
$('body').on('switchChange.bootstrapSwitch','.switch',function () {
alert('Done')
});