A checkbox component based on bootstrap framework
You can find demo and documentation here.
Create your <input type="checkbox">
with the .checkbox
class.
<input type="checkbox" class="chekbox" />
<input type="checkbox" class="chekbox" checked="checked"/>
<input type="checkbox" class="chekbox" disabled="disabled"/>
<input type="checkbox" class="chekbox" checked="checked" disabled="disabled"/>
Enable Bootstrap-checkbox via JavaScript:
$('.checkbox').checkbox();
Or just
$('input[type="checkbox"]').checkbox();
Options can be passed via data attributes or JavaScript.
$('input[type="checkbox"]').checkbox({
buttonStyle: 'btn-link',
buttonStyleChecked: 'btn-inverse',
checkedClass: 'icon-check',
uncheckedClass: 'icon-check-empty',
defaultState: false,
defaultEnabled: true,
checked: false,
enabled: true
});
You can append or prepend a label via the data-label
or data-label-prepend
attribute.
You can set a default state (used when you reset a form) via the data-default-state
attribute.
You can set a default abilitation (used when you reset a form) via the data-default-enabled
attribute.
$('input[type="checkbox"]').checkbox('click'); // change input's state
$('input[type="checkbox"]').checkbox('toggleEnabled'); // change input's enabled
Copyright (C) 2013 Roberto Montresor
Licensed under the MIT license.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.