I have 2 selects (a,b). Same data in both select. I want that when I choose an option in one of them, the same option disapear in the second one. If a reselect an other option, the one tha disapeared should reappears
tx
I have 2 selects (a,b). Same data in both select. I want that when I choose an option in one of them, the same option disapear in the second one. If a reselect an other option, the one tha disapeared should reappears
tx
check here http://jsfiddle.net/RTzwL/
html
<select id="first">
<option value="india">India</option>
<option value="usa">USA</option>
<option value="japan">Japan</option>
<option value="australia">Australia</option>
</select>
<select id="second">
<option value="india">India</option>
<option value="usa">USA</option>
<option value="japan">Japan</option>
<option value="australia">Australia</option>
</select>
Javascript
$('select').change(function() {
$(this).siblings('select').find('option').attr({disabled:false});
var thisIndex = parseInt($(this)[0].selectedIndex)+1;
$(this).siblings('select').find('option:nth-child('+thisIndex+')').attr({disabled:true});
});