JavaXT
|
|||||
Checkbox ClassForm input that can be either checked or unchecked. The input consists of a square box with a checkmark when selected.
Here's a simple example of how to instantiate a checkbox using an existing div (DOM element) and a minimal config. See config settings for a full range of options. var checkbox = new javaxt.dhtml.Checkbox(div, { label: "I Agree", checked: false });Once the checkbox is instantiated you can call any of the public methods. You can also add event listeners by overriding any of the public "on" or "before" methods like this: checkbox.onClick = function(checked){ console.log("I Agree", checked); }; ConstructorsUsed to instantiate this class
Config Optionsvalue 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.
style Style for individual elements within the component. Note that you can provide CSS class names instead of individual style definitions.
EventsPublic MethodsgetValue( ) 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. |