// Resets to the regular style $('#dimension-switch').bootstrapSwitch('setSizeClass', ''); // Sets a mini switch $('#dimension-switch').bootstrapSwitch('setSizeClass', 'switch-mini'); // Sets a small switch $('#dimension-switch').bootstrapSwitch('setSizeClass', 'switch-small'); // Sets a large switch $('#dimension-switch').bootstrapSwitch('setSizeClass', 'switch-large');
$('#change-color-switch').bootstrapSwitch('setOnClass', 'success'); $('#change-color-switch').bootstrapSwitch('setOffClass', 'danger');
// Enables animation for the selected item $('#animated-switch').bootstrapSwitch('setAnimated', true); // Disables animation for the selected item $('#animated-switch').bootstrapSwitch('setAnimated', false);
$('#label-switch').bootstrapSwitch('setOnLabel', 'I'); $('#label-switch').bootstrapSwitch('setOffLabel', 'O');
$('#mySwitch').on('switch-change', function (e, data) { var $el = $(data.el) , value = data.value; console.log(e, $el, value); });
$('#toggle-state-switch').bootstrapSwitch('status'); // true || false $('#toggle-state-switch').bootstrapSwitch('toggleState'); $('#toggle-state-switch').bootstrapSwitch('setState', false); // true || false
$('#destroy-switch').bootstrapSwitch('destroy');
$('#create-switch').wrap('').parent().bootstrapSwitch();
$('#disable-switch').bootstrapSwitch('isActive'); $('#disable-switch').bootstrapSwitch('toggleActivation'); $('#disable-switch').bootstrapSwitch('setActive', false); // true || false