I need to update a hidden field based on user selected button
Code:
<div id="bankRadioButtons">
<table>
<tr><td><input type="radio" id="Bank1" name="bankRadioButtons" /><label for="Bank1">Bank1</label></td></tr>
<tr><td><input type="radio" id="Bank2" name="bankRadioButtons" /><label for="Bank2">Bank2</label></td></tr>
<tr><td><input type="radio" id="Bank3" name="bankRadioButtons" /><label for="Bank3">Bank3</label></td></tr>
</table>
</div>
<input type="hidden" name="selectedBank" value="" />
Javascript code:
$("#bankRadioButtons").buttonset();
$("#bankRadioButtons").buttonset().bind('click', function(event) {
// I need to write code here to update the hidden field 'selectedBank' based on user selected bank radio button
}
Description
Give your radio buttons a
valuethen you can use jQuery’schange()andval()methods.Check out my sample and this jsFiddle Demonstration
Sample
More Information
Update
The following would will in better performance. Use
classand theidattribute in html.Updated jsFiddle