瀏覽代碼

Fixed placeholder detection. Fixes #424.

Kevin Brown 12 年之前
父節點
當前提交
c4c1cbabde
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      select2.js

+ 2 - 2
select2.js

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