Skip to content

Instantly share code, notes, and snippets.

Created May 1, 2016
Embed
What would you like to do?
<select class="selectBox">
<option value="disabled" selected="selected">Disabled</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<select class="selectBox">
<option value="disabled" selected="selected">Disabled</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<select class="selectBox">
<option value="disabled" selected="selected">Disabled</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<select class="selectBox">
<option value="disabled" selected="selected">Disabled</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
$('.selectBox').change(function() {
var current = $(this).val();
$(this).siblings().each(function() {
var val = $(this).val();
if(current == val) {
$(this).val('disabled');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment