Bootstrap switch change event not firing when state is changed from 'false' to 'true' dynamically

4.8k Views Asked by At

I am using Bootstrap Switch in my project to show a warning flag. Each time I try to set value of switch from false to true dynamically it is not going in .bootstrapSwitch().on method. It is working fine on changing switch state from false to true dynamically. Fiddle below-

http://jsfiddle.net/aanurn0j/

1

There are 1 best solutions below

3
On BEST ANSWER

Set third parameter to false and it works.

$('#toggleSwitchOn').click(function () {
    $('#bootstrapswitch').bootstrapSwitch('state', true, false);
});

jsFiddle