Checkbox Class

Form input that can be either checked or unchecked. The input consists of a square box with a checkmark when activated and text label.

Constructors

Checkbox( 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

label
Label for the checkbox (optional). Accepts either a string or a DOM element.
value
Value associated with the checkbox (optional). Note that this is different than the checkbox state. Use the isChecked() method to determine whether the checkbox is checked.
checked
If true, the checkbox will initially render with a check. Default is false.
disabled
If true, the component will be disabled when rendered. Default is false.
style
Style for individual elements within the component. Note that you can provide CSS class names instead of individual style definitions.

Events

onClick( checked )
Called whenever the checkbox is clicked.
onChange( checked )
Called whenever the checkbox value is changed.

Public Methods

enable( )
Used to enable the checkbox.
disable( )
Used to disable the checkbox.
select( silent )
Used to add a check to the checkbox.
deselect( silent )
Used to remove the check from the checkbox.
toggle( )
Used to toggle the checkbox state.
getValue( )
Returns the value associated with the checkbox. Note that this is different than the checkbox state. Use the isChecked() method to determine whether the checkbox is checked. The value is defined in the config used to instantiate this class.
isChecked( )
Returns true if the checkbox is checked.