File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,23 +9,43 @@ <h1 id="tags">Tagging support</h1>
99 Note that when tagging is enabled the user can select from pre-existing
1010 options or create a new tag by picking the first choice, which is what
1111 the user has typed into the search box so far.
12- To enable a multiple tags select, don't forget the < code > multiple</ code >
13- attribute.
1412 </ p >
1513
1614 < div class ="s2-example ">
1715 < p >
18- < select class ="js-example-tags form-control " multiple ="multiple ">
16+ < select class ="js-example-tags-multiple form-control " multiple ="multiple ">
1917 < option selected ="selected "> orange</ option >
2018 < option > white</ option >
2119 < option selected ="selected "> purple</ option >
2220 </ select >
2321 </ p >
2422 </ div >
2523
24+ {% highlight js linenos %}
25+ $(".js-example-tags-multiple").select2({
26+ tags: true
27+ })
28+ {% endhighlight %}
29+
30+ < p >
31+ Tagging can also be used on a single select element. Simply remove the
32+ < code > multiple="multiple"</ code > attribute from your HTML markup.
33+ </ p >
34+
35+ < div class ="s2-example ">
36+ < p >
37+ < select class ="js-example-tags form-control ">
38+ < option selected ="selected "> orange</ option >
39+ < option > white</ option >
40+ < option > purple</ option >
41+ </ select >
42+ </ p >
43+ </ div >
44+
2645{% highlight js linenos %}
2746$(".js-example-tags").select2({
2847 tags: true
2948})
3049{% endhighlight %}
50+
3151</ section >
You can’t perform that action at this time.
0 commit comments