我一直在测试bootstrap-duallistbox它太棒了,但我想知道如何在开始时禁用引导双列表框:
所以我有:
<select multiple="multiple" size="10" class="dual-list" disabled>
<option value="1">1</option>
<option value="2">2</option>
</select>
调用后:$(".dual-list").bootstrapDualListbox();
双列表未禁用。
最佳答案
查看您发布的链接的评论部分:
There is no built-in support for disable, so you need to disable the proper elements by selecting them by hand, something like that:
$('select[name="duallistbox_demo1[]_helper1"]').prop('disabled', true); $('select[name="duallistbox_demo1[]_helper2"]').prop('disabled', true); $('select[name="duallistbox_demo1[]"]').parent().find('.moveall').prop('disabled',true); $('select[name="duallistbox_demo1[]"]').parent().find('.move').prop('disabled',true); $('select[name="duallistbox_demo1[]"]').parent().find('.removeall').prop('disabled',true); $('select[name="duallistbox_demo1[]"]').parent().find('.remove').prop('disabled',true);
:) .. Well, I was managing this via this one line instead of 6 or 7. A property would have been cleaner. Thanks though
$(".bootstrap-duallistbox-container").find("*").prop("disabled",true);
关于javascript - 禁用 bootstrap-duallistbox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25247943/