as the tag says it's a button
, for that, you should do what it suggests, and work with those buttons... here's a simple example:
<input type="hidden" id="alignment" value="" />
<div class="btn-group alignment" data-toggle="buttons-checkbox">
<button type="button" class="btn">Left</button>
<button type="button" class="btn">Middle</button>
<button type="button" class="btn">Right</button>
</div>
now the jQuery:
$(".alignment .btn").click(function() {
// whenever a button is clicked, set the hidden helper
$("#alignment").val($(this).text());
});
upon submit, you will find the value in the alignment
hidden field.
Here's a basic example: http://jsbin.com/oveniw/1/
a good thing to take attention is that upon click, the element changes and bootstrap appends an active
class name to the clicked button.
You can always use this to change the hidden field
, but I would continue to do my example if I wanted to submit the form it self.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…