awgcas
posted Nov 18, 2023 at 17:26
Hi, I have 2 dropdowns, with same values read from a db table. When I select an option from the first one, I should like to have the same option disabled (or removed) in the second dropdown.
I tried something like this:
$('select[name=first]').on('change', function() {
var self = this;
$('select[name=second]').find('option').prop('disabled', function() {
return this.value == self.value
});
});
where first and second are names of dropdowns, but it doesn't work ...
Any suggestion?
Thank you
Alex
I tried something like this:
$('select[name=first]').on('change', function() {
var self = this;
$('select[name=second]').find('option').prop('disabled', function() {
return this.value == self.value
});
});
where first and second are names of dropdowns, but it doesn't work ...
Any suggestion?
Thank you
Alex