Jquery Group Radio selection -
i have radio buttons this
<input name="show[1]" type="radio" value="1" /> show<br> <input name="show[1]" type="radio" value="0" /> hide<br> <input name="show[2]" type="radio" value="1" /> show<br> <input name="show[2]" type="radio" value="0" /> hide<br> ... ... ... <input name="show[n]" type="radio" value="1" /> show<br> <input name="show[n]" type="radio" value="0" /> hide<br>
here length of n can varies.
this part of form submit. in jquery want make sure 1 of radio button each group should selected. how can this
try this:
$(':radio').each(function() { nam = $(this).attr('name'); if (submitme && !$(':radio[name="'+nam+'"]:checked').length) { alert(nam+' group not checked'); submitme = false; } });
Comments
Post a Comment