If I do :
var countryList = [
"London",
"Milan",
"New York"
];
$("#divDest").autocomplete({
source: countryList
});
the plugins will render somethings like this :
<ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all" role="listbox" aria-activedescendant="ui-active-menuitem" style="z-index: 21; top: 243px; left: 768px; display: none; width: 131px;">
<li class="ui-menu-item" role="menuitem">
<a class="ui-corner-all" tabindex="-1">London</a>
</li>
<li class="ui-menu-item" role="menuitem">
<a class="ui-corner-all" tabindex="-1">Milan</a>
</li>
<li class="ui-menu-item" role="menuitem">
<a class="ui-corner-all" tabindex="-1">New York</a>
</li>
</ul>
Well, suppose I'd like to put on the links not only the name of the country, but, in the title
attribute some other info (for example, the ID for each country). Such as :
<a class="ui-corner-all" tabindex="-1" title="country_3523">New York</a>
How can I do it with that plugins?
_renderItem: function( ul, item) {
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( $( "<a></a>" ).text( item.label ).attr('title', item.title) )
.appendTo( ul );
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.