I need a little help with jquery. I am trying to add link functionality to an auto complete list. Basically, it displays suggested links based on what is typed in the input. Below are the scripts that produce only the auto complete...
I am using a plugin (omitted from this post), but it can be viewed here if needed: https://www.cssscript.com/demo/autocomplete-typeahead-bootstrap-5/autocomplete.js
My code at the bottom of the HTML:
<script>
var datasrc = [
{label: 'About', value: 'about.html'},
{label: 'Components', value: 'components.html'},
{label: 'Usage', value: 'usage.html'},
]
const ac = new Autocomplete(document.getElementById('autosuggest'), {
data: datasrc,
treshold: 1,
maximumItems: 8,
onSelectItem: ({label, value}) => {
console.log("user selected:", label, value);
}
});
</script>
I ran into this post: JQuery Autocomplete Where the Results are Links - but I'm not sure how to integrate an "event function" into the above code.