javascript - How do I check which radio button is selected when there are multiple radio buttons with the same name? (using jquery) -
<form class="responses"> <input type="radio" name="choice" value="0">false</input> <input type="radio" name="choice" value="1">true</input> </form>
have tried:
$('[name="choice"]').is(':checked'))
if either checked returns true, if neither checked returns false, need see 1 checked.
i creating choices dynamically, , not giving each id.
the following code give value of checked radio button. if nothig checked give undefined. put snippet inside function , call function on checking radio button
$("input[name='choice']:checked").val()
Comments
Post a Comment