The problem statement is simple. I need to see if user has selected a radio button from a radio group. Every radio button in the group share same id.
The problem is
Simplest way to get the selected radio button's value is as follows:
$("input[name='optradio']:checked").val();
No space should be used in between selector.
Get all radios:
var radios = $("input[type='radio']");
Filter to get the one that's checked
radios.filter(":checked");
OR
Another way you can find radio button value
var RadeoButtonStatusCheck = $('form input[type=radio]:checked').val();
<input type="radio" class="radioBtnClass" name="numbers" value="1" />1<br/>
<input type="radio" class="radioBtnClass" name="numbers" value="2" />2<br/>
<input type="radio" class="radioBtnClass" name="numbers" value="3" />3<br/>
This will return, checked radio button value.
if($("input[type='radio'].radioBtnClass").is(':checked')) {
var card_type = $("input[type='radio'].radioBtnClass:checked").val();
alert(card_type);
}