UI checkboxes do not need javascript to function correctly, checkboxs can be triggered by matching the label's for attribute to the id tag of an input field
+However, there may be situations where it is less work to use javascript to initialize a checkbox then to manually assign ID tags to each field, or you might want to programmatically trigger the checkbox state. In these cases the checkbox module may be useful.
+ +Examples
+ +Initializing a check box
+Check Box
+The html required for a standard UI checkbox
+Radio Box
+The html required for a standard UI radio box
+A radio box is just a reskinned version of a checkbox, the initialization of the module is the same.
+Getting Started
+ +The plugin must be initialized once before methods can be accessed
+You can enable a checkbox programmatically using the enable method
+You can enable all checkboxes initialized at the same time by calling the enableAll method
+You can disable a checkbox programmatically using the disable method
+You can disable all checkboxes initialized at the same time by calling the disableAll method
+Settings
+Changing Settings
+-
+
- A settings object can be passed in when initializing the plugin
+
$('.foo') + .checkbox({ + moduleName: 'Godzilla' + }) +;+
+ - Default settings for the module can be overridden by modifying $.fn.Checkbox.settings.
+ $.fn.Checkbox.settings.moduleName = 'Godzilla';+
+
- Settings can be changed after a module is initialized by calling the 'settings' method on the module with either a settings object or a name, value pair.
+ $('.foo').checkbox('setting', 'moduleName', 'Godzilla');+
+
Reading Settings
+Settings can also be read programmatically:
Defaults
+Callbacks | + +||
---|---|---|
onChange | +None | +Callback after a checkbox is either disabled or enabled. | +
onEnable | +None | +Callback after a checkbox is enabled. | +
onDisable | +None | +Callback after a checkbox is disabled. | +
UI Module Settings | + +||
---|---|---|
moduleName | +Checkbox | +Name used in debug logs | +
debug | +True | +Provides standard debug output to console | +
performance | +False | +Provides standard debug output to console | +
verbose | +False | +Provides ancillary debug output to console | +
namespace | +checkbox | +Event namespace. Makes sure module teardown does not effect other events attached to an element. | +
errors | +
+ errors : {
+ method : 'The method you called is not defined.'
+}
+ |
+