Posted By

Meander365 on 10/19/10


Tagged

javascript jquery radio buttons


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


jQuery Determine if at least one radio button is checked in a radio group


 / Published in: jQuery
 

URL: http://stackoverflow.com/questions/1165627/jquery-and-radio-button-groups

  1. var radio_groups = {}
  2. $(":radio").each(function(){
  3. radio_groups[this.name] = true;
  4. })
  5.  
  6.  
  7. for(group in radio_groups){
  8. if ($(:radio[name="+group+"]:checked).length ==0) {
  9. //not checked
  10. } else {
  11. //checked
  12. }
  13.  
  14. }

Report this snippet  

You need to login to post a comment.