소스 검색

resize the search field to full width when placeholder is set. fixes #53

Igor Vaynberg 13 년 전
부모
커밋
5f00dd1cfd
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      select2.js

+ 4 - 3
select2.js

@@ -1177,11 +1177,12 @@
         clearSearch: function () {
             var placeholder = this.getPlaceholder();
 
-            this.search.val("").width(10);
-
             if (placeholder !== undefined && this.getVal().length === 0) {
                 this.search.val(placeholder).addClass("select2-default");
-                this.resizeSearch();
+                // stretch the search box to full width of the container so as much of the placeholder is visible as possible
+                this.search.width(this.getContainerWidth());
+            } else {
+                this.search.val("").width(10);
             }
         },