I currently use the jQuery UI Autocomplete in my application and I wanted to customize the design of the results, by turning the last word in the result a different color (say blue). For this I have used http://jqueryui.com/autocomplete/#custom-data as follows:
$(input).autocomplete(config)
.data("ui-autocomplete")._renderItem = function (ul, item) {
return $("<li>").append("<a>" + item.label + " " + "<span class=\"blue\">" + item.explicitLabel + "</span>" + "</a>").appendTo(ul);
};
Where item.label
is the autocomplete result without the last word and item.explicitLabel
is the last word. The only problem I have is, when searching, the last word (explicitLabel
) is ignored. Here is an example: http://jsfiddle.net/japZB/. What do I need to do to be able to search in the full output result?