Fork me on GitHub

Events  Version 3 (Stable)

All the events are namespaced, therefore always append .bootstrapSwitch when you attach your handlers.
You can register to the emitted events as follow:

$('input[name="my-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) {
  console.log(this); // DOM element
  console.log(event); // jQuery event
  console.log(state); // true | false
});
Name Description Parameters
init Triggered on initialization. 'this' refers to the DOM element. event (jQuery Event object)
switchChange Triggered on switch state change. 'this' refers to the DOM element. event (jQuery Event object), state (true | false)

Licensed under the Apache License, Version 2.0 · Created by Mattia Larentis · Mantained by Emanuele Marchi