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

  • SEARCH
  • Home
  • 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 7746679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:20:26+00:00 2026-06-01T10:20:26+00:00

I am trying to get autocomplete working working with JQuery UI, but I am

  • 0

I am trying to get autocomplete working working with JQuery UI, but I am having trouble when I try and pass in a label & value object.

        var people = [];
        var test = new Array();
        var obj = jQuery.parseJSON(data);
        $.each(obj.data, function(i,person){
                people[people.length] = {
                        label: person.id,
                        value: person.name
                };
                test.push(person.name);
        });

        $("#friend").autocomplete({
                source: test,
                select: function(event, ui) {
                    alert(ui.item.id);
                }
        });

When I use the ‘test’ array it is working correctly, but when I try and use the people object nothing seems to be working, an no JS errors either.

What am I missing?

  • 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-01T10:20:27+00:00Added an answer on June 1, 2026 at 10:20 am

    You are loading your people object backwards. Autocomplete works on the label, not the value, so you are autocompleting on your id instead of the name.

    label will be the text that is autocomplete uses to match, and value is what is returned when you choose it.

    Simply reverse them, and it will work:

     people[people.length] = {
         label: person.name,
         value: person.id
     };
    

    Demo: http://jsfiddle.net/qmmms/1/

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

Sidebar

Related Questions

I'm trying to get the jQuery UI autocomplete widget to work but I'm having
I've been trying to get the Zend Jquery autocomplete function working, when i noticed
I'm trying to get jQuery autocomplete working. The problem is that my json array
I am trying to get an autocomplete working and making an Ajax form submission
I'm trying to have a jQuery autocomplete. I have specified some data but when
I'm trying to get an autocomplete form working, and I can't seem to figure
I'm having a problem with my autocompletetextview. I'm trying to get the autocomplete get
I'm trying to get autocomplete to work on clones by using delegate, but it
Trying to get jquery AutoComplete to return and populate it's dropdown. The input and
I'm testing the JQUery Tools and trying to get a modal form working with

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.