Someone Someone - 9 months ago 45
jQuery Question

How do i know which radio button Has been Selected using Jquery

<input type="radio" id="radio1" name="rb1" value="no"> No
<input type="radio" id="radio2" name="rb1" value="yes"> Yes

when I say this
alert("Test =="+$('#radio1').attr('checked'));
I expect
because it's not checked but it returns

What is the correct statement?
Why am I getting

Answer Source

This post explains your exact problem:

i.e. you need to use this: alert($('#radio1').is(':checked'));