Thursday, 22 August 2013

Bootstrap checkbox/radio buttons do not change value

Bootstrap checkbox/radio buttons do not change value

The JavaScript page for Bootstrap shows some nice use of buttons to style
checkboxes and radio fields. For example, for a checkbox, I might write
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="checkbox"> Option 1
</label>
</div>
However, the library doesn't actually change the value of the underlying
<input> field -- it just changes whether the <label> field has class
active. I would have expected it to change the checked attribute on the
checkbox. Apparently I don't just have it misconfigured -- this is the way
the examples on the Bootstrap site work.
Is this actually expected behavior? If so, it seems fairly useless, as
people are going to want to use the checkbox field. If not, how do I
properly configure Bootstrap checkboxes/radio buttons?

No comments:

Post a Comment