From a587e39288fd4c9f71aa2e15ce2cd6987d05c7a2 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Parent Date: Thu, 30 Mar 2017 16:07:50 -0400 Subject: [PATCH] Add example for single select element --- docs/_includes/examples/tags.html | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/_includes/examples/tags.html b/docs/_includes/examples/tags.html index 456677d6..d64a27f1 100644 --- a/docs/_includes/examples/tags.html +++ b/docs/_includes/examples/tags.html @@ -9,13 +9,11 @@ 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 the user has typed into the search box so far. - To enable a multiple tags select, don't forget the multiple - attribute.

- @@ -23,9 +21,31 @@

+{% highlight js linenos %} +$(".js-example-tags-multiple").select2({ + tags: true +}) +{% endhighlight %} + +

+ Tagging can also be used on a single select element. Simply remove the + multiple="multiple" attribute from your HTML markup. +

+ +
+

+ +

+
+ {% highlight js linenos %} $(".js-example-tags").select2({ tags: true }) {% endhighlight %} +