From a469143f010a383ae6ae0d0bf0f9177c46ba236c Mon Sep 17 00:00:00 2001 From: Tim Atkinson Date: Tue, 2 Jul 2013 10:35:12 -0400 Subject: [PATCH] adding trim to opts.createSearchChoice default function to avoid mismatches with val object --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index ce3e8470..5d545ccf 100644 --- a/select2.js +++ b/select2.js @@ -960,7 +960,7 @@ the specific language governing permissions and limitations under the Apache Lic } else if ("tags" in opts) { opts.query = tags(opts.tags); if (opts.createSearchChoice === undefined) { - opts.createSearchChoice = function (term) { return {id: term, text: term}; }; + opts.createSearchChoice = function (term) { return {id: $.trim(term), text: $.trim(term)}; }; } if (opts.initSelection === undefined) { opts.initSelection = function (element, callback) {