<li class="ui-menu-item" role="presentation">
<a id="ui-id-12" class="ui-corner-all" tabindex="-1">Прага, Чехия <span>1376</span> </a></li>
<li class="ui-menu-item" role="presentation">
<a id="ui-id-22" class="ui-corner-all" tabindex="-1">
<span class="ui-menu-item-text">Прага</span>
<span class="ui-menu-item-clar">, Чехия</span>
<span class="ui-menu-item-comment">1377 отелей</span>
</a>
</li>
$("#hotelcityto").autocomplete({
source: "search.php",
...
$("#hotelcityto").autocomplete({
source: "search.php"}).autocomplete( "instance" )._renderItem = function(ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a><strong class='ui-item-name'>" + item.label + "</strong>, <span class='ui-item-country'>" + item.country + "</span>"+ (item.state ? ", " + item.state : "") +" <span class='ui-item-kolvo'>" + item.kolvo + "</span></a>")
.appendTo(ul);
};
$("#myTextField").autocomplete({
...
source: function( request ) { // Define source for AC data
..
$.ajax({ // Make Ajax call for AC data
...
success: function( data ) { // AC data returns
responseArray = $.map( data, function(item) { // build an array of hashmaps
..
return { label: item, customHTML: "<b>"+item+"</b>", classN: "someClassName"}; // "label" is inserted into text field when user selects it.
});
return responseArray;
}
}}