Add support for styling input checkbox fields.
A custom element is added before the browser default input checkbox field,
The valued is binded to the default browser checkbox field. When clicking on
the custom element they will updated the default input checkbox and vise versa.
Updates on the browser default field will also trigger updates on the custom input field.
Options can be passed to extend the defaults.
- Source:
- lib/checkbox/Checkbox.js, line 29
Example
var DEFAULTS = {
active: true, // active by default
ready: function() {}, // callback when module is ready.
customEle: 'a', // default element for handle.
containerEle: 'div', // default element for container.
autoHide: true, // will auto hide html element by default
classPrefix: 'custom-', // prefix used for class.
hideCss: { // styles can be overwritten or added.
position: 'absolute',
left: '-9999px'
},
element: obj, // input checkbox field.
events: [], // custom events can be added.
validators: [] // custom validators can be added.
};
customformsjs.module.Checkbox(DEFAULTS);