Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
borrowing heavily from http://github.com/scottgonzalez/jquery-ui-extensions/blob/master/autocomplete/jquery.ui.autocomplete.html.js, this extension adds support for a callback function for building the text of the item label.
(function ( $ )) {
$.ui.autocomplete.prototype._renderItem = function (ul, item) {
var text = (this.options.label) ? this.options.label( item ) : item.label;
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( $( "<a></a>" )[ this.options.html ? "html" : "text" ]( text );
.appendTo( ul );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment