javascript - Disabled bootstrap-duallistbox - Stack Overflow

I've been testing bootstrap-duallistbox and its fantastic, but I was wondering how to disable the

I've been testing bootstrap-duallistbox and its fantastic, but I was wondering how to disable the bootstrap-dual listbox at the beginning:

so I have:

<select multiple="multiple" size="10" class="dual-list" disabled>
 <option value="1">1</option>
 <option value="2">2</option>
</select>

after call: $(".dual-list").bootstrapDualListbox(); the dual list is not disabled.

I've been testing bootstrap-duallistbox and its fantastic, but I was wondering how to disable the bootstrap-dual listbox at the beginning:

so I have:

<select multiple="multiple" size="10" class="dual-list" disabled>
 <option value="1">1</option>
 <option value="2">2</option>
</select>

after call: $(".dual-list").bootstrapDualListbox(); the dual list is not disabled.

Share Improve this question asked Aug 11, 2014 at 16:24 Juan JardimJuan Jardim 2,2526 gold badges29 silver badges47 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

Look in the ments section of the link you posted:

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);

via István Ujj-Mészáros and WorkerBee

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744083483a4555735.html

相关推荐

  • javascript - Disabled bootstrap-duallistbox - Stack Overflow

    I've been testing bootstrap-duallistbox and its fantastic, but I was wondering how to disable the

    9天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信