forked from davidstutz/bootstrap-multiselect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
4732 lines (4411 loc) · 268 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Multiselect</title>
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="docs/css/bootstrap-3.3.2.min.css" type="text/css">
<link rel="stylesheet" href="docs/css/bootstrap-example.css" type="text/css">
<link rel="stylesheet" href="docs/css/prettify.css" type="text/css">
<script type="text/javascript" src="docs/js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="docs/js/bootstrap-3.3.2.min.js"></script>
<script type="text/javascript" src="docs/js/prettify.js"></script>
<link rel="stylesheet" href="dist/css/bootstrap-multiselect.css" type="text/css">
<script type="text/javascript" src="dist/js/bootstrap-multiselect.js"></script>
<script type="text/javascript" src="dist/js/bootstrap-multiselect-collapsible-groups.js"></script>
<script type="text/javascript">
$(document).ready(function() {
window.prettyPrint() && prettyPrint();
});
</script>
</head>
<body data-spy="scroll" data-target="#affix">
<a href="https://github.com/davidstutz/bootstrap-multiselect"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
<div class="container">
<div class="row">
<div class="col-md-3" id="affix">
<ul class="nav nav-pills nav-stacked sidebar" data-spy="affix" style="margin-top: 40px;">
<li class="active"><a href="#getting-started">Getting Started</a></li>
<li><a href="#configuration-options">Configuration Options</a></li>
<li><a href="#templates">Templates</a></li>
<li><a href="#methods">Methods</a></li>
<li><a href="#further-examples">Further Examples</a></li>
<li><a href="#post">Server-Side Processing</a></li>
<li><a href="#keyboard-support">Keyboard Support</a>
<li><a href="#faq">Frequently Asked Questions</a></li>
<li><a href="#known-issues">Known Issues</a></li>
<li><a href="tests/SpecRunner.html">Tests</a></li>
<li><a href="#license">License</a></li>
</ul>
</div>
<div class="col-md-9">
<div class="page-header">
<h1>Bootstrap Multiselect</h1>
</div>
<p class="alert alert-warning">
<b>Some option names may have changed during the last few commits!</b>
</p>
<p class="alert alert-info">
<b>Please consult the <a href="#faq">FAQ</a> and the <a href="https://github.com/davidstutz/bootstrap-multiselect/issues">Issue Tracker</a> before creating a new issue.</b>
</p>
<p class="alert alert-info">
<b>Please have a look at <a href="#how-to-contribute">How to contribute?</a> and the <a href="https://github.com/davidstutz/bootstrap-multiselect/issues">Issue Tracker</a>.</b>
</p>
<div class="page-header">
<h2 id="getting-started">Getting Started</h2>
</div>
<ol>
<li>
<h3>Link the Required Files</h3>
<p>
First, the <a href="http://jquery.com/" target="_blank">jQuery</a> library needs to be included. Then <a href="http://getbootstrap.com" target="_blank">Twitter Bootstrap</a> - both the Javascript library and the CSS stylesheet - needs to be included.
</p>
<pre class="prettyprint linenums">
<!-- Include Twitter Bootstrap and jQuery: -->
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- Include the plugin's CSS and JS: -->
<script type="text/javascript" src="js/bootstrap-multiselect.js"></script>
<link rel="stylesheet" href="css/bootstrap-multiselect.css" type="text/css"/>
</pre>
<p>
The jQuery library can also be included using a CDN, for example the <a href="https://developers.google.com/speed/libraries/devguide?hl=de&csw=1#jquery">Google CDN</a>:
</p>
<pre class="prettyprint linenums">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
</pre>
<p class="alert alert-info">
Note that the plugin will work both with version 2.x of the jQuery library as well as with version 1.10.x of the jQuery library. So for using the Google CDN you may have to adjust the version.
</p>
</li>
<li>
<h3>Create a Select</h3>
<p>
Now simply use HTML to create your <code>select</code> input which you want to turn into a multiselect. Remember to set the <code>multiple</code> attribute as to get a real multiselect - but do not worry, the plugin can also be used as usual select without the <code>multiple</code> attribute being present.
</p>
<pre class="prettyprint linenums">
<!-- Build your select: -->
<select id="example-getting-started" multiple="multiple">
<option value="cheese">Cheese</option>
<option value="tomatoes">Tomatoes</option>
<option value="mozarella">Mozzarella</option>
<option value="mushrooms">Mushrooms</option>
<option value="pepperoni">Pepperoni</option>
<option value="onions">Onions</option>
</select>
</pre>
</li>
<li>
<h3>Call the Plugin</h3>
<p>
In the end, simply call the plugin on your <code>select</code>. You may also specify further options, see the Options tab for further information.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-getting-started').multiselect();
});
</script>
<select id="example-getting-started" multiple="multiple">
<option value="cheese">Cheese</option>
<option value="tomatoes">Tomatoes</option>
<option value="Mozzarella">Mozzarella</option>
<option value="Mushrooms">Mushrooms</option>
<option value="Pepperoni">Pepperoni</option>
<option value="Onions">Onions</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<!-- Initialize the plugin: -->
<script type="text/javascript">
$(document).ready(function() {
$('#example-getting-started').multiselect();
});
</script>
</pre>
</div>
</li>
</ol>
<div class="page-header">
<h2 id="configuration-options">Configuration Options</h2>
</div>
<p class="alert alert-info">
Use Firebug, Chrome Developer Tools to get the best out of the below examples.
</p>
<table class="table">
<tbody>
<tr>
<td><code>multiple</code></td>
<td>
<p>
<code>multiple</code> is not a real configuration option. It refers to the <code>multiple</code> attribute of the <code>select</code> the plugin is applied on. When the <code>multiple</code> attribute of the <code>select</code> is present, the plugin uses checkboxes to allow multiple selections. If it is not present, the plugin uses radio buttons to allow single selections. When using the plugin for single selections (without the <code>multiple</code> attribute present), the first option will automatically be selected if no other option is selected in advance. See <a href="https://github.com/davidstutz/bootstrap-multiselect/issues/129">#129</a> for how to avoid this behavior.
</p>
<p>
The following example shows the default behavior when the <code>multiple</code> attribute is omitted:
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-single').multiselect();
});
</script>
<select id="example-single">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$('#example-single').multiselect();
</script>
<!-- Note the missing multiple attribute! -->
<select id="example-single">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</pre>
</div>
<p>
If multiple options are selected in advance and the <code>select</code> lacks the <code>multiple</code> attribute, the last option marked as <code>selected</code> will initially be selected by the plugin.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-single-selected').multiselect();
});
</script>
<select id="example-single-selected">
<option value="1">Option 1</option>
<option value="2" selected="selected">Option 2</option>
<option value="3" selected="selected">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$('#example-single-selected').multiselect();
</script>
<!-- Note the missing multiple attribute! -->
<select id="example-single-selected">
<option value="1">Option 1</option>
<option value="2" selected="selected">Option 2</option>
<!-- Option 3 will be selected in advance ... -->
<option value="3" selected="selected">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</pre>
</div>
<p>
The following example shows the default behavior when the <code>multiple</code> attribute is present. Initially selected options will be adopted automatically:
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-multiple-selected').multiselect();
});
</script>
<select id="example-multiple-selected" multiple="multiple">
<option value="1">Option 1</option>
<option value="2" selected="selected">Option 2</option>
<option value="3" selected="selected">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$('#example-multiple-selected').multiselect();
</script>
<!-- Note the missing multiple attribute! -->
<select id="example-multiple-selected" multiple="multiple">
<option value="1">Option 1</option>
<option value="2" selected="selected">Option 2</option>
<!-- Option 3 will be selected in advance ... -->
<option value="3" selected="selected">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</pre>
<p>
The plugin naturally supports <code>optgroup</code>'s, however the group headers are not clickable by default. See the <code>enableClickableOptGroups</code> option for details.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-multiple-optgroups').multiselect();
});
</script>
<select id="example-multiple-optgroups" multiple="multiple">
<optgroup label="Group 1">
<option value="1-1">Option 1.1</option>
<option value="1-2" selected="selected">Option 1.2</option>
<option value="1-3" selected="selected">Option 1.3</option>
</optgroup>
<optgroup label="Group 2">
<option value="2-1">Option 2.1</option>
<option value="2-2">Option 2.2</option>
<option value="2-3">Option 2.3</option>
</optgroup>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$('#example-multiple-optgroups').multiselect();
</script>
<select id="example-multiple-optgroups">
<optgroup label="Group 1">
<option value="1-1">Option 1.1</option>
<option value="1-2" selected="selected">Option 1.2</option>
<option value="1-3" selected="selected">Option 1.3</option>
</optgroup>
<optgroup label="Group 2">
<option value="2-1">Option 2.1</option>
<option value="2-2">Option 2.2</option>
<option value="2-3">Option 2.3</option>
</optgroup>
</select>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>enableHTML</code></td>
<td>
<p>
XSS injection is a serious thread for all modern web applications. Setting <code>enableHTML</code> to <code>false</code> (default setting) will create a XSS save multiselect.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-xss').multiselect();
});
</script>
<select id="example-xss" multiple="multiple">
<option value="1"><script>alert(1);</script></option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-xss').multiselect();
});
</script>
<select id="example-xss" multiple="multiple">
<option value="1">&lt;script&gt;alert(1);&lt;/script&gt;</option>
</select>
</pre>
<p>On the other hand, when setting <code>enableHTML</code> to <code>true</code>, the plugin will support HTML within <code>option</code>s:</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-xss-html').multiselect({
nonSelectedText: '<span style="color:red;">Non selected ...</span>',
enableHTML: true
});
});
</script>
<select id="example-xss-html" multiple="multiple">
<option value="1"><span style="color:red">Option 1</span></option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(doclect>
</pre>ument).ready(function() {
$('#example-xss-html').multiselect();
});
</script>
<select id="example-xss-html" multiple="multiple">
<option value="1">&gt;span style="color:red"&lt;Option 1&gt;/span&gt;</option>
</select>
</pre>
</td>
</tr>
<tr>
<td><code>enableClickableOptGroups</code></td>
<td>
<p>
If set to <code>true</code>, <code>optgroup</code>'s will be clickable, allowing to easily select multiple options belonging to the same group.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-enableClickableOptGroups').multiselect({
enableClickableOptGroups: true
});
});
</script>
<select id="example-enableClickableOptGroups" multiple="multiple">
<optgroup label="Group 1">
<option value="1-1">Option 1.1</option>
<option value="1-2" selected="selected">Option 1.2</option>
<option value="1-3" selected="selected">Option 1.3</option>
</optgroup>
<optgroup label="Group 2">
<option value="2-1">Option 2.1</option>
<option value="2-2">Option 2.2</option>
<option value="2-3">Option 2.3</option>
</optgroup>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-enableClickableOptGroups').multiselect({
enableClickableOptGroups: true
});
});
</script>
</pre>
</div>
<p>
Note that this option does also work with disabled options:
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-enableClickableOptGroups-disabled').multiselect({
enableClickableOptGroups: true,
includeSelectAllOption: true
});
});
</script>
<select id="example-enableClickableOptGroups-disabled" multiple="multiple">
<optgroup label="Group 1">
<option value="1-1" disabled>Option 1.1</option>
<option value="1-2" selected="selected">Option 1.2</option>
<option value="1-3" selected="selected">Option 1.3</option>
</optgroup>
<optgroup label="Group 2">
<option value="2-1" disabled>Option 2.1</option>
<option value="2-2">Option 2.2</option>
<option value="2-3">Option 2.3</option>
</optgroup>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-enableClickableOptGroups-disabled').multiselect({
enableClickableOptGroups: true
});
});
</script>
</pre>
</td>
</tr>
<tr>
<td>
<code>enableCollapsibleOptGroups</code>
</td>
<td>
<p class="alert alert-info">
For this option to be available, <code>bootstrap-multiselect-collapsible-groups.js</code> needs to be included.
</p>
<p>
Make your groups collapsible.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-enableCollapsibleOptGroups').multiselect({
enableCollapsibleOptGroups: true
});
});
</script>
<select id="example-enableCollapsibleOptGroups" multiple="multiple">
<optgroup label="Group 1">
<option value="1-1" disabled>Option 1.1</option>
<option value="1-2" selected="selected">Option 1.2</option>
<option value="1-3" selected="selected">Option 1.3</option>
</optgroup>
<optgroup label="Group 2">
<option value="2-1" disabled>Option 2.1</option>
<option value="2-2">Option 2.2</option>
<option value="2-3">Option 2.3</option>
</optgroup>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-enableCollapsibleOptGroups').multiselect({
enableCollapsibleOptGroups: true
});
});
</script>
<select id="example-enableCollapsibleOptGroups" multiple="multiple">
<optgroup label="Group 1">
<option value="1-1" disabled>Option 1.1</option>
<option value="1-2" selected="selected">Option 1.2</option>
<option value="1-3" selected="selected">Option 1.3</option>
</optgroup>
<optgroup label="Group 2">
<option value="2-1" disabled>Option 2.1</option>
<option value="2-2">Option 2.2</option>
<option value="2-3">Option 2.3</option>
</optgroup>
</select>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>disableIfEmpty</code></td>
<td>
<p>
If set to <code>true</code>, the multiselect will be disabled if no options are given.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-disableIfEmpty').multiselect({
disableIfEmpty: true
});
});
</script>
<select id="example-disableIfEmpty" multiple="multiple"></select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-disableIfEmpty').multiselect({
disableIfEmpty: true
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>dropRight</code></td>
<td>
<p>
The dropdown can also be dropped right.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-dropRight').multiselect({
buttonWidth: '400px',
dropRight: true
});
});
</script>
<select id="example-dropRight" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-dropRight').multiselect({
buttonWidth: '400px',
dropRight: true
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>maxHeight</code></td>
<td>
<p>
The maximum height of the dropdown. This is useful when using the plugin with plenty of options.
</p>
<div class="example">
<p>
The multiselect on the left uses <code>maxHeight</code> set to <code>200</code>. On the other hand, the multiselect on the right does not use <code>maxHeight</code>.
</p>
<script type="text/javascript">
$(document).ready(function() {
$('#example-with-maxHeight').multiselect({
maxHeight: 200
});
});
</script>
<select id="example-with-maxHeight" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
<option value="7">Option 7</option>
<option value="9">Option 8</option>
<option value="9">Option 9</option>
<option value="10">Option 10</option>
<option value="11">Option 11</option>
<option value="12">Option 12</option>
<option value="13">Option 13</option>
<option value="14">Option 14</option>
<option value="15">Option 15</option>
<option value="16">Option 16</option>
<option value="17">Option 17</option>
<option value="18">Option 18</option>
<option value="19">Option 19</option>
<option value="20">Option 20</option>
</select>
<script type="text/javascript">
$(document).ready(function() {
$('#example-without-maxHeight').multiselect();
});
</script>
<select id="example-without-maxHeight" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
<option value="7">Option 7</option>
<option value="9">Option 8</option>
<option value="9">Option 9</option>
<option value="10">Option 10</option>
<option value="11">Option 11</option>
<option value="12">Option 12</option>
<option value="13">Option 13</option>
<option value="14">Option 14</option>
<option value="15">Option 15</option>
<option value="16">Option 16</option>
<option value="17">Option 17</option>
<option value="18">Option 18</option>
<option value="19">Option 19</option>
<option value="20">Option 20</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-with-maxHeight').multiselect({
maxHeight: 200
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>checkboxName</code></td>
<td>
<p>
The name used for the generated checkboxes. See <a href="#post">Server-Side Processing</a> for details.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-checkboxName').multiselect({
checkboxName: 'multiselect[]'
});
});
</script>
<select id="example-checkboxName" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-checkboxName').multiselect({
checkboxName: 'multiselect[]'
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>onChange</code></td>
<td>
<p>
A function which is triggered on the change event of the options. Note that the event is not triggered when selecting or deselecting options using the <code>select</code> and <code>deselect</code> methods provided by the plugin.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-onChange').multiselect({
onChange: function(option, checked, select) {
alert('Changed option ' + $(option).val() + '.');
}
});
});
</script>
<select id="example-onChange" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-onChange').multiselect({
onChange: function(option, checked, select) {
alert('Changed option ' + $(option).val() + '.');
}
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>onDropdownShow</code></td>
<td>
<p>
A callback called when the dropdown is shown.
</p>
<p class="alert alert-warning">
The <code>onDropdownShow</code> option is not available when using Twitter Bootstrap 2.3.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-onDropdownShow').multiselect({
onDropdownShow: function(event) {
alert('Dropdown shown.');
}
});
});
</script>
<select id="example-onDropdownShow" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-onDropdownShow').multiselect({
onDropdownShow: function(event) {
alert('Dropdown shown.');
}
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>onDropdownHide</code></td>
<td>
<p>
A callback called when the dropdown is closed.
</p>
<p class="alert alert-warning">
The <code>onDropdownHide</code> option is not available when using Twitter Bootstrap 2.3.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-onDropdownHide').multiselect({
onDropdownHide: function(event) {
alert('Dropdown closed.');
}
});
});
</script>
<select id="example-onDropdownHide" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-onDropdownHide').multiselect({
onDropdownHide: function(event) {
alert('Dropdown closed.');
}
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>onDropdownShown</code></td>
<td>
<p>
A callback called <i>after</i> the dropdown has been shown.
</p>
<p class="alert alert-warning">
The <code>onDropdownShown</code> option is not available when using Twitter Bootstrap 2.3.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-onDropdownShown').multiselect({
onDropdownShown: function(event) {
alert('Dropdown shown.');
}
});
});
</script>
<select id="example-onDropdownShown" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-onDropdownShown').multiselect({
onDropdownShown: function(event) {
alert('Dropdown closed.');
}
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>onDropdownHidden</code></td>
<td>
<p>
A callback called <i>after</i> the dropdown has been closed.
</p>
<p class="alert alert-warning">
The <code>onDropdownHidden</code> option is not available when using Twitter Bootstrap 2.3.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-onDropdownHidden').multiselect({
onDropdownHidden: function(event) {
alert('Dropdown closed.');
}
});
});
</script>
<select id="example-onDropdownHidden" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-ondropdownHidden').multiselect({
onDropdownHidden: function(event) {
alert('Dropdown closed.');
}
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>buttonClass</code></td>
<td>
<p>
The class of the multiselect button.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-buttonClass').multiselect({
buttonClass: 'btn btn-link'
});
});
</script>
<select id="example-buttonClass" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-buttonClass').multiselect({
buttonClass: 'btn btn-link'
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>
<td><code>inheritClass</code></td>
<td>
<p>
Inherit the class of the button from the original select.
</p>
<div class="example">
<script type="text/javascript">
$(document).ready(function() {
$('#example-inheritButton').multiselect({
inheritClass: true
});
});
</script>
<select id="example-inheritButton" class="btn-primary" multiple="multiple">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
<option value="6">Option 6</option>
</select>
</div>
<div class="highlight">
<pre class="prettyprint linenums">
<script type="text/javascript">
$(document).ready(function() {
$('#example-inheritButton').multiselect({
inheritClass: true
});
});
</script>
</pre>
</div>
</td>
</tr>
<tr>