Hi I have this variable in jquery that gets the value of checked input radio button,
var gender = [];
$("input[type='radio'][name='gender\\[$counter\\]']:checked").each(function ()
{
gender.push($(this).val());
});
console.log(gender);
My input field looks like this,
<input id="gender" value="Male" name="gender[$counter]" type="radio" />
<input id="gender" value="Female" name="gender[$counter]" type="radio" />
But the console.log(gender); returns the value "[ ]" but not the value of that input field. What seems to be the problem? Please help.