Hi Pullo and everyone else,
I’m still battling to implement jQuery UI autocomplete.
I’d like the tags? to load the appropriate page upon selection by the user. I found the following code but it also doesn’t work. What must I change? Any tag/label would have to be associated with a corresponding value/URL - right? Once I get the autocomplete going, I’d like to populate it with items from a database.
Also, in your opinion, is jQuery UI autocomplete the best option or are there other ones you can recommend?
Any help will be appreciated! I’ve spent too much time trying to get the autocomplete to do something. Other jQUERY UI plugins were easy enough to implement. Thank you!
<script>
var source = [ { value: "www.foo.com",
label: "Asp"
},
];
$(document).ready(function() {
$("input#autocomplete").autocomplete({
source: source,
select: function( event, ui ) {
window.location.href = ui.item.value;
}
});
});
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: availableTags
});
});
</script>