In Plain Ole' Javascript, do I NEED to use a loop to loop through the radio buttons/checkboxes to see if they are checked or is there a simpler way of doing this?
            Asked
            
        
        
            Active
            
        
            Viewed 450 times
        
    1 Answers
3
            Yes. It may be most helpful to...
- ...have them all contained in one element, so you can traverse through its children
- ...apply a class name to all of them, to use document.getElementsByClassName
- ...use document.getElementsByTagName(though, the tag is theinputtag, so you may get other elements as well)
However, that is just getting the elements; but as you've stated, you will still need to iterate through each one to do whatever comparison you like. jQuery will allow you to do this kind of thing more easily, but "Plain Ole' Javascript" cannot.
 
    
    
        Jon Newmuis
        
- 25,722
- 2
- 45
- 57
