Change jQuery autocomplete
jQuery has an autocomplete code that works like the search box on google. However it doesn't allow for the drop down items to be clickable links. I'm not that great with jQuery. Is there any way to alter the jQuery autocomplete code to make the items links?
Also if possible i wou开发者_JS百科ld like to alter that code again so that when the user uses the arrow keys to scroll down the dropdown, the hovered item doesnt appear in the search box
Heres the link to the jQuery code: http://jqueryui.com/demos/autocomplete/
It's right there in the docs: http://jqueryui.com/demos/autocomplete/#event-select You must change the select event appropriately:
$( ".selector" ).autocomplete({
select: function(event, ui) { window.location = "www.google.com"
}
});
There is a way for you to control the actual html that is displayed.
It is in fact shown on the page you linked to
http://jqueryui.com/demos/autocomplete/#custom-data
There is no reason why you should not be able to make the drop down links.
精彩评论