Skip to content

Commit bdd7468

Browse files
committed
tweak formatSelection for select2#400
1 parent c098f51 commit bdd7468

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

select2.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,8 +2059,10 @@
20592059
val = this.getVal(),
20602060
formatted;
20612061

2062-
formatted=this.opts.formatSelection(data, choice);
2063-
choice.find("div").replaceWith("<div>"+this.opts.escapeMarkup(formatted)+"</div>");
2062+
formatted=this.opts.formatSelection(data, choice.find("div"));
2063+
if (formatted != undefined) {
2064+
choice.find("div").replaceWith("<div>"+this.opts.escapeMarkup(formatted)+"</div>");
2065+
}
20642066
choice.find(".select2-search-choice-close")
20652067
.bind("mousedown", killEvent)
20662068
.bind("click dblclick", this.bind(function (e) {

0 commit comments

Comments
 (0)