Tuesday, 6 August 2013

Bootstrap 3 radio button correct syntax

Bootstrap 3 radio button correct syntax

So I have been in the process of migrating my current project from
Bootstrap 2.3 to Bootstrap 3 which has had some major structural changes
particularly to due with radio buttons. Currently I have,
HTML:
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input id="emViewMacsButton"
name="options" type="radio">MAC
</label>
<label class="btn btn-primary">
<input id="emViewTagsButton"
name="options" type="radio">Tags
</label>
<label class="btn btn-primary">
<input id="emViewSettingsButton"
name="options" type="radio">Settings
</label>
</div>
SCRIPT CODE:
$('#emViewMacsButton').on('click',emViewMacs());
$('#emViewTagsButton').on('click',emViewTags());
$('#emViewSettingsButton').on('click',emViewSettings());
My problem lies in that I have setup my program that each of the different
radio buttons must access a different function to display table data. The
.on('click') function returns nothing. I've also tried
$('input[name=options]') but the active attribute isn't set for any of the
radio buttons on the returned piece of html.... What would be the correct
structure for this????

No comments:

Post a Comment