Add example for single select element
This commit is contained in:
parent
e5fc98dda9
commit
a587e39288
@ -9,13 +9,11 @@
|
|||||||
Note that when tagging is enabled the user can select from pre-existing
|
Note that when tagging is enabled the user can select from pre-existing
|
||||||
options or create a new tag by picking the first choice, which is what
|
options or create a new tag by picking the first choice, which is what
|
||||||
the user has typed into the search box so far.
|
the user has typed into the search box so far.
|
||||||
To enable a multiple tags select, don't forget the <code>multiple</code>
|
|
||||||
attribute.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="s2-example">
|
<div class="s2-example">
|
||||||
<p>
|
<p>
|
||||||
<select class="js-example-tags form-control" multiple="multiple">
|
<select class="js-example-tags-multiple form-control" multiple="multiple">
|
||||||
<option selected="selected">orange</option>
|
<option selected="selected">orange</option>
|
||||||
<option>white</option>
|
<option>white</option>
|
||||||
<option selected="selected">purple</option>
|
<option selected="selected">purple</option>
|
||||||
@ -23,9 +21,31 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% highlight js linenos %}
|
||||||
|
$(".js-example-tags-multiple").select2({
|
||||||
|
tags: true
|
||||||
|
})
|
||||||
|
{% endhighlight %}
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Tagging can also be used on a single select element. Simply remove the
|
||||||
|
<code>multiple="multiple"</code> attribute from your HTML markup.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="s2-example">
|
||||||
|
<p>
|
||||||
|
<select class="js-example-tags form-control">
|
||||||
|
<option selected="selected">orange</option>
|
||||||
|
<option>white</option>
|
||||||
|
<option>purple</option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% highlight js linenos %}
|
{% highlight js linenos %}
|
||||||
$(".js-example-tags").select2({
|
$(".js-example-tags").select2({
|
||||||
tags: true
|
tags: true
|
||||||
})
|
})
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user