I'm dynamically generating multiple dropdown lists on button click, with the same currency values. Now I've to compare that none of the dropdown lists should have the duplicate value. Eg. On button click I generated a
Dropdownlist1, Dropwdownlist2, Dropwdownlist3
and
Dropdownlist4
and all have same values, let's say
1,2,3,4,5
Now if I've selected 2 in any of the lists then this value should not be allowed to select from any of the remaining lists.
Since, I'm generating the lists dynamically so I'm not having multiple Ids also. I tried from my end but I could compare the selected value for only two lists and with static ids. Thank you.
$("#currenciesList2").change(function() {
if ($(this).val() === $("#currenciesList1").val()) {
alert('Duplicate currency value');
$(this).val('');
}
});