我一直在测试bootstrap-duallistbox和它的奇妙,但我想知道如何在开始时禁用bootstrap-dual列表框:
所以我有:
<select multiple="multiple" size="10" class="dual-list" disabled>
<option value="1">1</option>
<option value="2">2</option>
</select>
Run Code Online (Sandbox Code Playgroud)
通话后:$(".dual-list").bootstrapDualListbox();双重列表未禁用.
查看您发布的链接的评论部分:
没有内置的禁用功能支持,因此您需要通过手动选择来禁用正确的元素,如下所示:
Run Code Online (Sandbox Code Playgroud)$('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);:) ..好吧,我通过这一行而不是6或7管理这个.一个属性会更清洁.谢谢
Run Code Online (Sandbox Code Playgroud)$(".bootstrap-duallistbox-container").find("*").prop("disabled",true);
通过IstvánUjj- Mészáros和WorkerBee