I'm having a problem of validating my form. I have more than 6 different drop down selection objects. Here are the first two as example:
<table id="ProjectTable">
<tr><td>
<select id="selected1" selectedIndex=0>
<option></option>
<option>o1</option>
<option>o2</option>
<option>o3</option>
<option>o4</option>
</select>
</td>
<td>
<select id="selected2" selectedIndex=0>
<option></option>
<option>10</option>
<option>12</option>
<option>13</option>
<option>14</option>
</select>
</td></tr></table>
<button type="button">Submit</button>
What I would like to do is to validate the drop down selection that if users select the empty option (default is the first option), and hit submit. Then it will get the error and notify the users that they have to select one option in each drop down selection. The six drop down selection ID is generated dynamically. I know that I could use jQuery .each() function to loop through the select element.
Can anyone help me about this? Thanks