Skip to content

Commit e13dc41

Browse files
author
Igor Vaynberg
committed
fix placeholder in multiselects when blurred by clicking outside
1 parent 84f031f commit e13dc41

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

select2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@
959959
this.close();
960960
this.container.removeClass("select2-container-active");
961961
this.dropdown.removeClass("select2-drop-active");
962+
if (this.search.is(":focus")) { this.search.blur(); }
962963
this.clearSearch();
963964
this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
964965
},
@@ -1317,7 +1318,7 @@
13171318
// TODO validate placeholder is a string if specified
13181319

13191320
if (opts.element.get(0).tagName.toLowerCase() === "select") {
1320-
// install sthe selection initializer
1321+
// install the selection initializer
13211322
opts.initSelection = function (element) {
13221323
var data = [];
13231324
element.find(":selected").each2(function (i, elm) {
@@ -1454,7 +1455,6 @@
14541455
var placeholder = this.getPlaceholder();
14551456

14561457
if (placeholder !== undefined && this.getVal().length === 0 && this.search.hasClass("select2-focused") === false) {
1457-
14581458
this.search.val(placeholder).addClass("select2-default");
14591459
// stretch the search box to full width of the container so as much of the placeholder is visible as possible
14601460
this.search.width(this.getContainerWidth());

0 commit comments

Comments
 (0)