A control that lets the user switch an option between two states: on (checked is set to true) and off (checked is set to false).
Creates a new ToggleSwitch.
The DOM that hosts the control.
An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events. Event names must begin with "on". For example, to provide a handler for the change event, add a property named "onchange" to the options object and set its value to the event handler.
Gets or sets a value that specifies whether the control is on or off.
Gets or sets a value that specifies whether the control is disabled.
Gets the DOM element that hosts the ToggleSwitch.
Gets or sets the text that displays when the ToggleSwitch is off (checked is set to false).
Gets or sets the text that displays when the ToggleSwitch is on (checked is set to true).
Gets or sets the main text for the ToggleSwitch control. This text is always displayed, regardless of whether the control is switched on or off.
Registers an event handler for the specified event.
The name of the event to handle.
The event handler function to associate with the event.
Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase.
Raises an event of the specified type and with additional properties.
The type (name) of the event.
The set of additional properties to be attached to the event object when the event is raised.
boolean
true if preventDefault was called on the event, otherwise false.
Releases resources held by this ToggleSwitch. Call this method when the ToggleSwitch is no longer needed. After calling this method, the ToggleSwitch becomes unusable.
Handles the specified event.
The event.
Occurs when the ToggleSwitch control is flipped to on (checked == true) or off (checked == false).
An object that contains information about the event.
Raises an event of the specified type and with additional properties.
The type (name) of the event.
The set of additional properties to be attached to the event object when the event is raised.
boolean
true if preventDefault was called on the event, otherwise false.
Removes an event handler that the addEventListener method registered.
The name of the event that the event handler is registered for.
The event handler function to remove.
Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler.