Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8938213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:34:30+00:00 2026-06-15T10:34:30+00:00

In this basic example using jQuery autocomplete: $(#textboxid).autocomplete( { source: testdata, delay: 100, minLength:

  • 0

In this basic example using jQuery autocomplete:

$("#textboxid").autocomplete(
    {
        source: testdata,
        delay: 100,
        minLength: 1
    });

where testdata is a local array of data, what is the recommended way to have any changes to the underlying source array, reflect in the autocomplete options?

Currently, if I subsequently add a new item to the testdata array (i.e. after the autocomplete has already been setup on the textbox element), I don’t see that new option in the autocomplete list. If I dynamically add a new textbox to the page and set up for autocomplete, it does see the new option. But existing elements do not.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:34:31+00:00Added an answer on June 15, 2026 at 10:34 am

    The most flexible way is to use a callback as the source, which polls your array/object/server for the data and returns the appropriate response.

    Here is an example of how you could test this:

    var testdata = ["foo","bar","baz","quux"];
    $("#textboxid").autocomplete({
        source: function(request, callback) {
            var possiblematches = testdata.filter(function(v) {
                return v.match($.ui.autocomplete.escapeRegex(request.term));
            });
            callback(possiblematches);
        },
        delay: 100
    });
    

    A demonstration: http://jsfiddle.net/Eeg5L/. Documentation and further information for the source option can be found here.

    Alternatively, you could reset the source after modifying the array using:

    $("#textboxid").autocomplete("option","source", testdata);
    

    I’d recommend using a setter for your array that does this automatically whenever you modify the array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this jquery ui autocomplete but i need to grab the data
I am using the Basic Grid example from jqGrid Demos : jQuery("#rowed1").jqGrid( { url
This is a very basic example of what I am trying to implement in
I have started learning HTTPUNIT and found one basic example. In this example it
I've created this basic 3D Demo using OpenGL/SDL. I handled the keyboard callback so
I have searched for a bit on a basic example on using the John
I am using this jQuery form validation plugin: http://docs.jquery.com/Plugins/Validation/Methods I am trying to use
I'm using the jQuery mobile basic list to display a list of products. (
I'm using the jQuery UI Autocomplete function. I can make it work with the
So I have this site that dynamically posts content using jquery and php. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.