Created
July 25, 2014 08:34
-
-
Save Strae/e055f7285f5fd6b7c069 to your computer and use it in GitHub Desktop.
Adding custom htlm elements to chosen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// chosen.jquery.js, function Chosen.prototype.set_up_html, add this in row 582 | |
if('undefined' !== this.options.afterContent){ | |
var afterContent = jQuery(document.createElement('div')) | |
.addClass('chosen-after-content') | |
.html(this.options.afterContent); | |
this.container.find('ul.chosen-results').after(afterContent); | |
} | |
// then add your custom html like | |
jQuery("#foo").chosen({ | |
afterContent: '<span id="button" class="btn btn-primary icon-ok btn-xs">Click me</span>' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not simply do this on the
chosen:ready
event?