Я хочу запретить множественный выбор одного и того же значения, но значение = «другие» может только множественный выбор
мой код такой
function preventDupes( select, index ) {
var options = select.options,
len = options.length;
while( len-- ) {
//options[ len ].disabled = false;
}
//select.options[ index ].disabled = true;
if( index === select.selectedIndex ) {
if(select.selectedIndex !== "Others"){
if(select.selectedIndex != "") {
alert('You\'ve already selected the item "' + select.options[index].text + '".\n\nPlease choose another.');
}
this.selectedIndex = 0;
}
} else if(index === "other") {
}
}
var f61 = select = document.getElementById( 'f61' );
var f62 = select = document.getElementById( 'f62' );
var f63 = select = document.getElementById( 'f63' );
f61.onchange = function() {
preventDupes.call(this, f62, this.selectedIndex );
preventDupes.call(this, f63, this.selectedIndex );
};
f62.onchange = function() {
preventDupes.call(this, f61, this.selectedIndex );
preventDupes.call(this, f63, this.selectedIndex );
};
f63.onchange = function() {
preventDupes.call(this, f62, this.selectedIndex );
preventDupes.call(this, f61, this.selectedIndex );
};
<select name="indication_subject[]" id="f61">
<option value="" selected="selected">Subject </option>
<option value="Accounting"> Accounting</option>
<option value="Afrikaans"> Afrikaans</option>
<option value="Arabic"> Arabic</option>
<option value="other">Others</option>
</select>
<select name="indication_subject[]" id="f61">
<option value="" selected="selected">Subject </option>
<option value="Accounting"> Accounting</option>
<option value="Afrikaans"> Afrikaans</option>
<option value="Arabic"> Arabic</option>
<option value="other">Others</option>
</select>
<select name="indication_subject[]" id="f63">
<option value="" selected="selected">Subject </option>
<option value="Accounting"> Accounting</option>
<option value="Afrikaans"> Afrikaans</option>
<option value="Arabic"> Arabic</option>
<option value="other">Others</option>
</select>
есть идеи по этому поводу?