Boostrap multiselect默认情况下全选 [英] Boostrap multiselect select all checked by default

查看:1116
本文介绍了Boostrap multiselect默认情况下全选的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将bootstrap-multiselect(v0.9.8)与选项一起使用

i use bootstrap-multiselect (v0.9.8) with option

 includeSelectAllOption: true 

是否有可能在加载页面时默认选中所有要检查的内容?

it is posible that select all to be checked by default when page is loaded?

thx.

推荐答案

以下内容摘自 http://davidstutz.github .io/bootstrap-multiselect/,我目前正在将此解决方案与bootstrap 3.3.1和bootstrap-multiselect v0.9.8结合使用 请确保在"selectAll"函数中添加false参数,因为它允许您选择所有选项而无需先打开下拉菜单.

The following is taken from http://davidstutz.github.io/bootstrap-multiselect/, and I am currently using this solution with bootstrap 3.3.1 and bootstrap-multiselect v0.9.8 Be sure to add the false parameter to the 'selectAll' function as that permits you to select all the options without first opening the dropdown.

HTML示例:

<select class="multiselect" id="my-multi-select" name="options[]" multiple="multiple">
    <option>1</option>
    <option>2</option>
</select>

示例javascript:

Example javascript:

$(function() {

    $('#my-multi-select').multiselect({
        includeSelectAllOption: true
    });

    $("#my-multi-select").multiselect('selectAll', false);
    $("#my-multi-select").multiselect('updateButtonText');

});

这篇关于Boostrap multiselect默认情况下全选的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆