user780483
user780483

Reputation: 3063

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 would 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/

Upvotes: 0

Views: 166

Answers (2)

Sruly
Sruly

Reputation: 10550

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.

Upvotes: 0

Uku Loskit
Uku Loskit

Reputation: 42040

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"
   }
});

Upvotes: 3

Related Questions