For the following HTML:
<form name="myForm">
<label>One<input name="area" type="radio" value="S" /></label>
<label>Two<input name="area" type="radio" value="R" /></label>
<label>Three<input name="area" type="radio" value="O" /></label>
<label>Four<input name="area" type="radio" value="U" /></label>
</form>
Changing from the following javascript code:
$(function() {
var myForm = document.myForm ;
var radios = myForm.area ;
// Loop through radio buttons
for (var i=0; i<radios.length; i++) {
if (radios[i].value == "S") {
radios[i].checked = true ; // Selected when form displays
radioClicks() ; // Execute the function, initial setup
}
radios[i].onclick = radioClicks ; // Assign to run when clicked
}
});
Thanks
EDIT: The response I selected answers the question I asked, however I like the answer that uses bind() because it also shows how to distinguish the group of radio buttons