Reputation: 23
I am trying to disable options in dropdowns if they have been selected in other dropdowns with jquery. The following link almost answered my question:
But... my selections are already selected (selected = "selected") so the jquery doesn't work as it requires the user to make a selection for the code to initiate.
Is there a way to do this when your options are already selected?
Upvotes: 2
Views: 153
Reputation: 33933
What about to "trigger" a change on each select on document ready ?
Just add this:
$(document).ready(function(){
$("select.positionTypes").each(function(){
$(this).trigger("change");
});
});
See CodePen
Upvotes: 1