Remove An Option Once It Is Selected In Previous Dropdowns
I need to remove the selected option in a dropdown that was selected on the previous dropdwon. For example the first, second and third dropdown contain A, B, C, D. Once I selected
Solution 1:
Here is pure HTML/JS example. Basically on page load each select has same options. When you select something, on other selects this option hides.
Solution 2:
The code from Lolo works very fine but I needed to change style.dispaly = 'none'
in o.disabled = true
to avoid a problem with Chrome/Safari in OSX and iOS (element not hidden)
if (p == undefined || p == s) {
o.disabled = false;
}
// option otherwiseelse {
o.disabled = true;
}
The behavior is different but the result is the same.
Post a Comment for "Remove An Option Once It Is Selected In Previous Dropdowns"