Lets say I have a bunch of form elements with the same class:
1. <input type="text" class="answer1">
2. <input type="radio" class="answer1" value="123">
3. <input type="checkbox" class="answer1" value="abc">
I need to write a function that will get all the values entered by the user:
1. Any text they typed into a text box
2. The value of a radio button, if selected
3. The value of a check box, if checked
I need to be able to loop through all the entered/select values, so I can handle each one individually. I know how to get single values, such as:
...etc. But if there are a variety of types of form elements on the same page, is there some relatively easy way to do this? Possibly, I need to setup separate loops, one for each type of form element, and then combine those into a list? Not sure that it would be a good idea to do a attr('checked') on a text box, though.
Would appreciate any advice. Thank you!