javascript - 禁用 bootstrap-duallistbox

标签 javascript jquery

我一直在测试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);

通过 István Ujj-MészárosWorkerBee

关于javascript - 禁用 bootstrap-duallistbox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25247943/

相关文章:

javascript - 在 SCORM 中跟踪 HTML5 变量

javascript - ReactJS 提交带有默认值的表单

javascript - 为什么我的 js 函数返回的是自身而不是返回值? [ Angular ]

jquery ui 自动完成 : how to keep the select list open until a selection has been made

jQuery:如何在 html 下拉列表中选择多个项目?

javascript - 使用 jquery 的音频播放器

javascript - 。裹();破坏 prevent.Default();

javascript - 单击时增加多个元素

javascript - 如何运行在一页上添加两个 "image slideshow"

javascript - 使用 AJAX 自动更新