Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
AutocompleteJS Update data src

I'm using Autocomplete.JS for my input field. On input i run a function that updates an array with search results. I want Autocomplete.JS to use this array. But for some reason it just wont update.

My Autocomplete.JS Setup:

autoCompleteJS = new autoComplete({
        selector: "#searchBar",
        placeHolder: "Search for Github Account/Repository...",
        submit: true,
        data: {
            src: autoCompleteSearches
        },
        resultItem: {
            highlight: {
                render: true
            }
        },
        events: {
            input: {
                selection: (event) => {
                    const selection = event.detail.selection.value;
                    autoCompleteJS.input.value = selection;
                }
            }
        }
    });

And here is my eventlistner that updates the array:

inputField.addEventListener("input", async (event) => {
    if (inputField.value.length % 5 === 0) {
        let search = await searchUser(inputField.value);
        autoCompleteSearches = [];
        search.forEach(searchItem => {
            autoCompleteSearches.push(searchItem.login)
        });
        console.log(autoCompleteJS)

    }
})

The event listener works as intended and updates "autocompleteSearches". But Autocomplete.JS doesnt use them.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!