Reputation: 169
I have multiple forms each with a radiobutton group Basically I want to only allow the user to select one of the options once. In my case only allow selection of Yes once
You can see the behaviour in the link below
Seems to ignore the selection in this line of the jquery code
$('input:radio[name=$(tmp)]]')[1].checked = true;
Upvotes: 0
Views: 914
Reputation: 76880
You could do something like this :
$("input[name*='records']").click(function(e) {
var inputs = $("form input[type=radio][value=Y]:checked");
if (inputs.length > 1){
e.preventDefault();
}
});
Fiddle here: http://jsfiddle.net/6EQHE/5/
Upvotes: 2
Reputation: 7802
change it to:
$('input:radio[name=$(tmp)]]')[1].attr('checked', 'checked');
Upvotes: 0