Instead of the Success event, use the _renderItem event.
Real implementation on Vroom . Enter the airport, you will see the image on the left.
NOTE. _renderItem below has some complicated calculations. Do not do this, just use this idea.
$("#myInput") .autocomplete({ minLength: 0, delay: 10, source: function (req, responseFn) { //Your ajax call here returning only responseFn Array having item.id and item.id }, select: function (event, ui) { //action upon selecting an item return false; } }) .data("autocomplete") ._renderItem = function (ul, item) { return $("<li></li>") .data("item.autocomplete", item) .append("<a><span class='airoplane'>" + (item[0] + (item[2] == "" ? "" : ", " + item[2]) + (item[1] == "" ? "" : " (" + item[1] + ")")).replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(this.term).replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<span class='highlight'>$1</span>") + "</span></a>") .appendTo(ul); };
source share