here is my html code
<td style="display:none">
<div class="col-sm-6">
<select class="form-control" id="riexclusion">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</div>
</td>
i want to get the selected value from the dropdown list of every row.
I tried this jquery to retrieve the value..
var selectedstatus = $('#riexclusion option:selected').text();
alert(selectedstatus);
var totalrow = $("#ritable > tbody > tr").length;
for (var i = 0; i <= totalrow; i++) {
exclusion = $('tbody#riDecisionvalues tr:eq(' + i + ')td:eq(8)').select();
}
help me with this...
add jsfiddle
First of all you need to remove duplicate ids instead you can use class as shown below -
<td style="display:none">
<div class="col-sm-6">
<select class="form-control" class="riexclusion">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</div>
</td>
Use below jQuery to get each selected value from dropdown
//iterate all select under each tr
$("#ritable tbody tr").find(".riexclusion").each(function(){
selectedVal = $(this).val();
alert(selectedVal);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With