I have a php script that generates a form of all radio button types. The form consists of ratings questions (1-10 values), true or false(2 values), and another type that has 4 values. Since the form displayed is different based on the user i wanted to create a javascript (im using jquery) to validate the form dynamically also so i dont have to check for each value individually. I just need to make sure that each radio group has a value. Each radio button has a class of .input but each radio group obviously has a different name and different values. So far i can loop through, and alert the value of the checked radio buttons: $('.input').each(function(){ if($(this).is(":radio:checked")) { alert("attribute"+$(this).attr('name')+" value="+$(this).val()); } }); Code (markup): I'm not really sure to go from here. I need to check if there are any null values in any null groups and display an error if there is.
On the first line, you have $('.input'), but this means you are selecting all elements, which have "input" class set. Try to make it $('input') (without the dot)... Maybe there will be problem with the rest of the script too, but try this first.