bootstrap的下拉多选框如何使用


当前第2页 返回上一页

默认样式,添加样式:data-style="class名"

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

<select class="selectpicker" data-style="btn-primary">

  ...

</select>

<select class="selectpicker" data-style="btn-info">

  ...

</select>

<select class="selectpicker" data-style="btn-success">

  ...

</select>

<select class="selectpicker" data-style="btn-warning">

  ...

</select>

<select class="selectpicker" data-style="btn-danger">

  ...

</select>

c.png

相关推荐:《bootstrap入门教程》

添加检索:data-live-search="true"

1

<select class="selectpicker" data-live-search="true">....</select>

v.png

Select多选:

添加“multiple ” 设置为多选,并且设置最多能选择2项 data-max-options="2"

1

<select class="selectpicker form-control" multiple data-max-options="2">...</select>

效果:b.png

添加检索:data-live-search="true"

设置检索placeholder属性:data-live-search-placeholder="搜索"

添加“全选/反选” 功能按钮 data-actions-box="true"

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

<select class="selectpicker" multiple data-live-search="true" data-live-search-placeholder="搜索"

data-actions-box="true">

  <optgroup label="filter1">

    <option>option1</option>

    <option selected>option2</option>

    <option>option3</option>

    <option>option4</option>

  </optgroup>

  <optgroup label="filter2">

    <option>option1</option>

    <option>option2</option>

    <option>option3</option>

    <option>option4</option>

  </optgroup>

  <optgroup label="filter3">

    <option>option1</option>

    <option>option2</option>

    <option>option3</option>

    <option>option4</option>

  </optgroup>

</select>

效果:n.png

js初始化,设置选定的值

1

2

$('.selectpicker').selectpicker('val','mustard');

$('.selectpicker').selectpicker('val',['mustard','relish']);

更新UI

1

$('.selectpicker').selectpicker('refresh');

选中事件

1

2

$('.selectpicker').on('changed.bs.select',function(e){

});

以上就是bootstrap的下拉多选框如何使用的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

bootstrap是不是js库

bootstrap与vue区别

bootstrap是什么,有什么特点?

bootstrap 怎么关闭弹出框

bootstrap怎么添加样式表

bootstrap的下拉多选框如何使用

bootstrap如何更改nav颜色

bootstrap用来做什么

bootstrap里面有什么东西

bootstrap模态框怎么用

更多相关阅读请进入《bootstrap》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...