javascript - Get values of all checked radio buttons using JQuery -
using jquery trying perform validation , values of dynamically generated radio buttons in page.
i have 10 questions on page , each question has radio button group(yes/no).
when click in radio button want send it's value database question, code
<p>question 1</p> <input id="1_1" type="radio" name="1" value="yes" /> <input id="1_2" type="radio" name="1" value="no" />
i searched in google , found code
$('input[name=radioname]:checked', '#myform').val()
but don't know right way use ?
as per html structure try :-
var arr = []; // take array store values $('input[type="radio"][name="1"]:checked').each(function(){ arr.push($(this).val()); //push values in array });
Comments
Post a Comment