I have two tables Table1 and Table2.
Each table contains tag and the options and their values were same.
Now I want to check for each table,
$('#table1 tr').each(function() {
$(this).find('select').change(function() { //alert($(this).val())
if ($('#table1 tr td select option[value=' + $(this).val() + ']:selected').length > 1) {
alert('option is already selected');
$(this).val($(this).find("option:first").val());
}
});
});
$('#table2 tr').each(function() {
$(this).find('select').change(function() { //alert($(this).val())
if ($('#table2 tr td select option[value=' + $(this).val() + ']:selected').length > 1) {
alert('option is already selected');
$(this).val($(this).find("option:first").val());
}
});
});