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;     } }); 

working demo


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -