How do i disable selected options in many drop-down list boxes but leave one of them enabled? The box that i need to have the options enabled has the following html code and has and id of (x_captain). Other options in the boxes are disabled dynamically. List box whose all options must be re-enabled for selection.
HTML:
<select class="x_captain" id="x_captain" name="x_captain">
<option value="1" disabled="disabled">W.SZCZESNY, GK</option>
<option value="13" disabled="disabled">E.VIVIANO, GK</option>
</select>
i have the following Code that disables all the duplicates in all select boxes.
jQuery:
<script>
$('select').click(function() {
var selections = [];
$('select option:selected').each(function(){
if($(this).val())
selections.push($(this).val());
})
$('select option').each(function() {
$(this).attr('disabled', $.inArray($(this).val(),selections)>-1 && !$(this).is(":selected"));
});
});
</script>
Thank you