Cristian Rojas
Cristian Rojas

Reputation: 2862

jQuery bootstrap-switch 3.0.2 is not triggering change event on the input

I've just updated the jQuery bootstrap-switch plugin to the latest version that includes so many interesting and cool features, but I'd a working code that looks like:

var $checkbox = $('input[name="whatever"]');

$checkbox.bootstrapSwitch();

$checkbox.on('change', function() {
  // ... do something cool here
});

And when I toggle the switch a change event was being triggered in the input, cool because the above code works if so, but... with the last update this is not happening!

I know there are an onSwitchChange callback that I can use to identify changes on the input but you know I don't want to refactor 100 lines of code before knowing if I'm missing something.

Upvotes: 0

Views: 895

Answers (1)

Icepick
Icepick

Reputation: 156

This has worked for me. Version 3.0.2

        $elem.on('switchChange.bootstrapSwitch', function (e, data) {
          //Do something
        });

Upvotes: 1

Related Questions