【发布时间】:2013-12-02 09:31:57
【问题描述】:
我需要的是,如果用户选择值为 0 的选项禁用选择中的整个组,或者如果我不能使用组禁用我想要的所有选项,有可能吗?
我试过这样:
$('#ottipo_alcance').chosen().change(function(event){
if (this.value == '0')
$('optgroup option').prop('disabled', true);
else
$('optgroup option').prop('disabled', false);
$('#ottipo_alcance').trigger("liszt:updated");
});
<select id="ottipo_alcance" name="ottipo_alcance[]" class="chosen" style="width:200px" multiple="true">
<option value="0">General</option>
<optgroup label="Áreas">
<option value="1">Sistemas</option>
<option value="2">Operaciones</option>
...
</optgroup>
</select>
注意:我也试过 $('#ottipo_alcance').trigger("chosen:updated");
【问题讨论】:
标签: jquery jquery-chosen