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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -