Browse Source

Fixed placeholder detection. Fixes #424.

Kevin Brown 12 years ago
parent
commit
c4c1cbabde
1 changed files with 2 additions and 2 deletions
  1. 2 2
      select2.js

+ 2 - 2
select2.js

@@ -1587,7 +1587,7 @@
         // single
         // single
         initSelection: function () {
         initSelection: function () {
             var selected;
             var selected;
-            if (this.opts.element.val() === "") {
+            if (this.opts.element.val() === "" && this.opts.element.text() === "") {
                 this.close();
                 this.close();
                 this.setPlaceholder();
                 this.setPlaceholder();
             } else {
             } else {
@@ -1921,7 +1921,7 @@
         // multi
         // multi
         initSelection: function () {
         initSelection: function () {
             var data;
             var data;
-            if (this.opts.element.val() === "") {
+            if (this.opts.element.val() === "" && this.opts.element.text() === "") {
                 this.updateSelection([]);
                 this.updateSelection([]);
                 this.close();
                 this.close();
                 // set the placeholder if necessary
                 // set the placeholder if necessary