Thank you for taking the time to read this. I am working on customizing the jQuery UI autocomplete search feature to display clickable link results, and so far, I have been successful in my efforts by referencing code from another query on this forum.
My challenge now is that I anticipate having a large number of links to display which cannot be efficiently stored as a variable directly on the page. In the past, I used the old version of jQuery autocomplete (pre-UI) and was able to store the variable "updates" in a separate javascript file. However, with the new jQuery UI version, I am unsure how to achieve the same result. The reference link for the previous version can be found here...
The javascript file utilized there was named "localdata.js"
If anyone knows how to transition from sourcing data from a variable on the HTML page to an external javascript file with identical content for the jQuery UI version, your help would be greatly appreciated.
I have also consulted the migration guide available at but have not been able to resolve this issue yet.
The existing working code that does not refer to an external file is provided below...
<script>
$(function() {
var updates = [
{ value: "http://www.google.com", label: "Google"},
{ value: "http://www.yahoo.com", label: "Yahoo!"},
];
$("input#autocomplete").autocomplete({
source: updates,
select: function( event, ui ) {
window.location.href = ui.item.value;
}
});
});
</script>
I understand that the required change needs to be made on the line "source:updates," but I am unsure of the correct steps. Thank you once again for reading and any assistance you may provide.