Browse Source

Merge pull request #2702 from dgroux/master

allow formatSelection to return a jQuery object
Kevin Brown 10 years ago
parent
commit
c1df0aa942
1 changed files with 1 additions and 1 deletions
  1. 1 1
      select2.js

+ 1 - 1
select2.js

@@ -3058,7 +3058,7 @@ the specific language governing permissions and limitations under the Apache Lic
 
 
             formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
             formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
             if (formatted != undefined) {
             if (formatted != undefined) {
-                choice.find("div").replaceWith("<div>"+formatted+"</div>");
+                choice.find("div").replaceWith($("<div></div>").html(formatted));
             }
             }
             cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
             cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
             if (cssClass != undefined) {
             if (cssClass != undefined) {