If you're just holding the possible lookups locally, as opposed to a database, then something like:
Code:
$(function() {
var webSites = [{value:"Google",url:"http://www.google.com"},{value:"Coding Forums",url:"http://codingforums.com"}];
//autocomplete
$("#lookup").autocomplete({
source: webSites,//look up the variable already created
minLength: 2,//search after two characters,
select: function(event,ui){
window.location.href = ui.item.url;//on select, navigate to the url selected
}
});
});
ought to do the job. UI Autocomplete shows the field 'value' in the dropdown, here we're also retrieving a field 'url', which we then use to load a new page on select.
If you're holding the data in a database then it's pretty much the same principle, but obviously you'd need to connect to and retrieve from the database.