From 891102ff4722d7a9b4afa90fe885baa2bc4f7387 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Thu, 26 Apr 2012 19:46:24 -0700 Subject: [PATCH] fix select event syncing. closes #41 --- select2.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/select2.js b/select2.js index 89f79c2d..2f054663 100755 --- a/select2.js +++ b/select2.js @@ -921,7 +921,7 @@ if (opts.element.get(0).tagName.toLowerCase() === "select") { // install sthe selection initializer - this.opts.initSelection = function (element) { + opts.initSelection = function (element) { var selected = element.find(":selected"); // a single select box always has a value, no need to null check 'selected' return {id: selected.attr("value"), text: selected.text()}; @@ -1061,9 +1061,10 @@ // TODO validate placeholder is a string if specified + if (opts.element.get(0).tagName.toLowerCase() === "select") { // install sthe selection initializer - this.opts.initSelection = function (element) { + opts.initSelection = function (element) { var data = []; element.find(":selected").each(function () { data.push({id: $(this).attr("value"), text: $(this).text()});