Switch Class

Basic on/off toggle switch

Constructors

Switch( parent, config )
Used to instantiate this class
parentDOM element in which to render this component
configConfiguration settings (optional). See config options for more information.

Config Options

value
If true, the slider will be set to the on position.
style
Style for individual elements within the component. Note that you can provide CSS class names instead of individual style definitions.

Events

onChange( value )
Called when the input value changes

Public Methods

getValue( )
Returns true on the slider is set to the on/active position. Otherwise returns false.
setValue( b, silent )
Used to set the slider to the on or off position.
bIf true, sets the slider to the on position. Otherwise, the slider will be set to the off position.
silentBy default, this slider will fire the onChange event whenever the value is changed. When silent is set to true, the slider will NOT fire the onChange event. This parameter is optional.