Explorar o código

fix select event syncing. closes #41

Igor Vaynberg %!s(int64=13) %!d(string=hai) anos
pai
achega
891102ff47
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      select2.js

+ 3 - 2
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()});