Skip to content

Commit 891102f

Browse files
committed
fix select event syncing. closes select2#41
1 parent 37ddcb6 commit 891102f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

select2.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@
921921

922922
if (opts.element.get(0).tagName.toLowerCase() === "select") {
923923
// install sthe selection initializer
924-
this.opts.initSelection = function (element) {
924+
opts.initSelection = function (element) {
925925
var selected = element.find(":selected");
926926
// a single select box always has a value, no need to null check 'selected'
927927
return {id: selected.attr("value"), text: selected.text()};
@@ -1061,9 +1061,10 @@
10611061

10621062
// TODO validate placeholder is a string if specified
10631063

1064+
10641065
if (opts.element.get(0).tagName.toLowerCase() === "select") {
10651066
// install sthe selection initializer
1066-
this.opts.initSelection = function (element) {
1067+
opts.initSelection = function (element) {
10671068
var data = [];
10681069
element.find(":selected").each(function () {
10691070
data.push({id: $(this).attr("value"), text: $(this).text()});

0 commit comments

Comments
 (0)