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> @@ -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");}); }); @@ -1107,7 +1107,7 @@ $(document).ready(function () {
tokenSeparators
and createSearchChoice
options are specified. The default tokenizer will split the string using any separator in tokenSeparators
- and will create and select choice objects using createSearhChoice
option. It will also
+ and will create and select choice objects using createSearchChoice
option. It will also
ignore duplicates, silently swallowing those tokens.
select2-focus
-Fired when the control is focussed. +
Fired when the control is focused.
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:
true
if search term matches the option text, or false
otherwisefunction(term, text) { return text.toUpperCase().indexOf(term.toUpperCase())>0; }
options.context
parameter to the query
function above.alert("Selected value is: "+$("#e8").select2("val")); $("#e8").select2("val", {id:"CA", text:"Califoria"});+Example:
alert("Selected value is: "+$("#e8").select2("val")); $("#e8").select2("val", {id:"CA", text:"California"});
destroy
id
attribute of a loaded result objectalert("Selected value is: "+$("#e8").select2("val")); $("#e8").select2("val", {id:"CA", text:"Califoria"});+ Example:
alert("Selected value is: "+$("#e8").select2("val")); $("#e8").select2("val", {id:"CA", text:"California"});
Events
cancelled
Signalled when the user cancells the selection of a result. For example, when ESC is pressed after the dropdown has been opened
+Signalled when the user cancels the selection of a result. For example, when ESC is pressed after the dropdown has been opened
selected
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:
@@ -475,7 +475,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> @@ -672,7 +672,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") @@ -684,7 +684,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");}); }); @@ -1142,7 +1142,7 @@ $(document).ready(function () {
tokenSeparators
and createSearchChoice
options are specified. The default tokenizer will split the string using any separator in tokenSeparators
- and will create and select choice objects using createSearhChoice
option. It will also
+ and will create and select choice objects using createSearchChoice
option. It will also
ignore duplicates, silently swallowing those tokens.