试试这个:http://jsfiddle.net/rM88C/2/
应允许您添加的“jQuery的选择了”下拉菜单中的不确定量,并有任何选择的值“已禁用”在所有的下拉列表中使用相同的类名。我提供了多选版本,但为了您的目的将其转换为单一选择版本应该是微不足道的。
Javascript代码下面提供的,但检查出小提琴第一
// get selects for later use
var selects = $('.myChosen');
// whenever the selection changes, either disable or enable the
// option in the other selects
selects.chosen().change(function() {
var selected = [];
// add all selected options to the array
selects.find("option").each(function() {
if (this.selected) {
selected[this.value] = this;
}
})
// disable or enable options
.each(function() {
// if the current option is already selected in another select disable it.
// otherwise, enable it.
this.disabled = selected[this.value] && selected[this.value] !== this;
});
// trigger the change event in the other "chosen" selects
selects.trigger("chosen:updated");
});