Documentation

v2.0.1

All the options are accepted only using data-* attributes on the element.
checked, disabled and readonly are exceptions to the rule, being default HTML input attributes.
Therefore, there is not any way to specify the options in JavaScript during initialization.

NameTypeDescriptionValuesDefault
stateBooleanThe checkbox statetrue, false'checked' attribute or true
sizeStringThe checkbox state'', 'mini', 'small', 'normal', 'large'''
animateBooleanAnimate the switchtrue, falsetrue
disabledBooleanDisable statetrue, false'disabled' attribute or false
readonlyBooleanReadonly statetrue, false'readonly' attribute or false
onStringColor of the left side of the switch'primary', 'info', 'success', 'warning', 'danger', 'default'null
offStringColor of the right side of the switch'primary', 'info', 'success', 'warning', 'danger', 'default'null
on-labelStringText of the left side of the switchString'ON'
off-labelStringText of the right side of the switchString'OFF'
label-textStringText of the center handle of the switchString' '
label-iconStringText of the center handle of the switch. Use to include external services iconsStringnull
NameDescriptionAccepted ValuesReturned Values
stateGet checkbox statetrue, false
setStateSet checkbox state(value: true, false)[, skip: true, false]jQuery Object (input element)
toggleStateToggle checkbox state[skip: true, false]jQuery Object (input element)
toggleRadioStateToggle radio state[skip: true, false]jQuery Object (input element)
toggleRadioStateAllowUncheckToggle radio state allowing uncheck of the radio input[uncheck: true, false | skip: true, false]jQuery Object (input element)
setSizeClassSet the size of the switch'', 'mini', 'small', 'normal', 'large'jQuery Object (input element)
setAnimatedAnimate the switchtrue, falsejQuery Object (input element)
isDisabledGet disabled statetrue, false
setDisabledSet disable statetrue, falsejQuery Object (input element)
toggleDisabledToggle disabled statejQuery Object (input element)
isReadOnlyGet Readonly statetrue, false
setReadOnlySet Readonly statetrue, falsejQuery Object (input element)
toggleReadOnlyToggle readonly statejQuery Object (input element)
setOnClassColor of the left side of the switch'primary', 'info', 'success', 'warning', 'danger', 'default'jQuery Object (input element)
setOffClassColor of the right side of the switch'primary', 'info', 'success', 'warning', 'danger', 'default'jQuery Object (input element)
setOnLabelText of the left side of the switchStringjQuery Object (input element)
setOffLabelText of the right side of the switchStringjQuery Object (input element)
setTextLabelText of the center handle of the switchStringnull
setTextIconText of the center handle of the switch. Use to include external services iconsStringnull
destroyDestroy the instance of Bootstrap SwitchjQuery Object (input element)

The only event triggered is switch-change. It returns two parameters: event and data.
The latter is an object that includes el (the input DOM element) and value (the new input state)