I have a dynamic html code that populate firstname & lastname, it also add a column of drop down selection of Gender and text input field for them to report income and car model. The list of names sometime can be just 2 rows or 50 rows depending on which data it is reading from. the html look as below..
<tr><td style='width:50px; class='reg' value=''>+FName+</td>
<td style='width:50px; class='reg' value=''>+LName+</td>
<td style='width:50px; class='reg' id='gend'>
<select>
<option value='F'>Female</option>
<option value='M'>Male</option>
</selected></td>
<td style='width:50px; class='reg' value=''><input class='inp' type='text'></td>
<td style='width:50px; class='reg' value=''><input class='inp' type='text'></td>
</tr>
my Jquery looks like
cap=$("#gend option:selected").map(function(){
return $(this).val();
}).get().join(",");
})
The query partially works because it is only captures the first row dropdown. if I have 2 + rows it only capture the first drop down selected only. is there a way to capture all rows selected from dropdown? when I change the Jquery from option:selected to option, I can see all the options for each row. Basically if I have 3 rows I see both F,M three times. I am not sure what I am missing? Also can I make one of the option as default?