diff --git a/select2.js b/select2.js index 60d4a4c6..bd3ab0a4 100644 --- a/select2.js +++ b/select2.js @@ -955,7 +955,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) {