Multi-Value Select Boxes
-Select2 also supports multi-value select boxes. The select
below is declared with the multiple
attribute. Select2 automatially picks up on this:
Select2 also supports multi-value select boxes. The select
below is declared with the multiple
attribute. Select2 automatically picks up on this:
@@ -462,7 +462,7 @@ $("#e2_2").select2({
Example Code
- You can set data-
attributes to <option>
(or <optgroup>) and use them inside temptlating functions:
+ You can set data-
attributes to <option>
(or <optgroup>) and use them inside templating functions:
<select> @@ -487,7 +487,7 @@ function format(state) {-
In order to take advantage of custom data loading Select2 should be attached to an
+input type='hidden'
tag, otherwise data is parsed fromselect
'soption
tags.In order to take advantage of custom data loading Select2 should be attached to an
input type='hidden'
tag, otherwise data is parsed fromselect
'soption
tags.
Example Code
@@ -665,7 +665,7 @@ $("#e11") .on("select2-selecting", function(e) { log ("selecting val="+ e.val+" choice="+ JSON.stringify(e.choice));}) .on("select2-removing", function(e) { log ("removing val="+ e.val+" choice="+ JSON.stringify(e.choice));}) .on("select2-removed", function(e) { log ("removed val="+ e.val+" choice="+ JSON.stringify(e.choice));}) - .on("select2-loaded", function(e) { log ("loaded (data property omitted for brevitiy)");}) + .on("select2-loaded", function(e) { log ("loaded (data property omitted for brevity)");}) .on("select2-focus", function(e) { log ("focus");}) .on("select2-blur", function(e) { log ("blur");}); $("#e11_2") @@ -677,7 +677,7 @@ $("#e11_2") .on("select2-selecting", function(e) { log ("selecting val="+ e.val+" choice="+ JSON.stringify(e.choice));}) .on("select2-removing", function(e) { log ("removing val="+ e.val+" choice="+ JSON.stringify(e.choice));}) .on("select2-removed", function(e) { log ("removed val="+ e.val+" choice="+ JSON.stringify(e.choice));}) - .on("select2-loaded", function(e) { log ("loaded (data property omitted for brevitiy)");}) + .on("select2-loaded", function(e) { log ("loaded (data property omitted for brevity)");}) .on("select2-focus", function(e) { log ("focus");}) .on("select2-blur", function(e) { log ("blur");}); }); @@ -761,7 +761,7 @@ $("#e11_2") by separating them with a comma or a space. Try typing in the search field below and entering a space or a comma. -Note that the separators are defined in the tokenSeparators option.
+Note that the separators are defined in the tokenSeparators option.
Note that this example uses the built in tokenizer function, but a custom one can be provided in the options.