I have radio buttons in HTML like this:
1
-
I know this is old and that this is a little off topic, but supposing you wanted to uncheck only specific radio buttons in a collection:
$("#go").click(function(){
$("input[name='correctAnswer']").each(function(){
if($(this).val() !== "1"){
$(this).prop("checked",false);
}
});
});
1
2
3
4
And if you are dealing with a radiobutton list, you can use the :checked selector to get just the one you want.
$("#go").click(function(){
$("input[name='correctAnswer']:checked").prop("checked",false);
});
1
2
3
4
- 热议问题