I have two radio buttons in my form, and until I started using jQuery 1.6, the following code worked fine:
<input type="radio" id="radio1" name="test"/>
<input type="radio" id="radio2" name="test"/>
<input type="button" onclick="testcheck()" value="Test"/>
<script>
function testcheck()
{
if (jQuery("#radio1").attr("checked"))
alert("first button checked");
else if (jQuery("#radio2").attr("checked"))
alert("second button checked");
else
alert("none checked")
}
</script>
As soon as I start using jQuery 1.6, it always shows "none checked" because it is jQuery(radiobutton).attr("checked")always empty.
Take a look at jsfiddle and change the jQuery version between 1.5.2 and 1.6 to see what I mean.
source
share