應用此fiddle解決方案,但沒有任何運氣:(我試圖jQuery的禁用所選選項
$('.select').on('keyup change', function() {
var selected = [];
$(".select option:selected").each(function() {
if ($(this).val() !== "") selected.push($(this).val());
});
$(".select:not(this) option").each(function() {
if (selected.indexOf($(this).val()) > -1) $(this).prop("disabled", true);
else $(this).prop("disabled", false);
});
});
我想使殘疾人從先前選擇列表中的所有選定的項目。
如果有人知道如何在添加新人員時禁用所選項目? – lewis4u
我解決了我的問題....只是將第一行更改爲:$(document).on('click','.select',function(){ – lewis4u