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 7934169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:33:49+00:00 2026-06-03T21:33:49+00:00

I used the Custom data and display example at http://jqueryui.com/demos/autocomplete/ and simplified it a

  • 0

I used the “Custom data and display” example at http://jqueryui.com/demos/autocomplete/ and simplified it a bit so I can have values and ID’s like so:

$(function() {
    var prd = [
        { s: "hallo", v: "1" },
        { s: "hey", v: "2" },
        { s: "alloh", v: "3" }
    ];
    $("#product").autocomplete({
        source: prd,
        minLength: 0,
        focus: function(event, ui) {
            $("#product").val(ui.item.s);
            return false;
        },
        select: function(event, ui) {
            $("#product").val(ui.item.s);
            $("#productId").val(ui.item.v);
            return false;
        }
    }).data("autocomplete")._renderItem = function(ul, item) {
        return $("<li></li>")
            .data("item.autocomplete", item)
            .append("<a>" + item.s + "</a>")
            .appendTo(ul);
    };
});

The problem is that without the minLength:0 it will never ever pop up, and with the minLength:0 it only pops up with an empty textbox (type a char and then delete it).

  • 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-03T21:33:51+00:00Added an answer on June 3, 2026 at 9:33 pm

    Jqueryui autocomplete’s use of “label” and “value” is almost automagical. Change your ‘s’ and ‘v’ back to ‘label’ and ‘value’ and everything will work as expected:

      <script>
        $(function() {
            var prd = [
                { label: "hallo", value: "1" },
                { label: "hey", value: "2" },
                { label: "alloh", value: "3" }
            ];
            $("#product").autocomplete({
                source: prd,
                minLength: 0,
                focus: function(event, ui) {
                    $("#product").val(ui.item.label);
                    return false;
                },
                select: function(event, ui) {
                    $("#product").val(ui.item.label);
                    $("#productId").val(ui.item.value);
                    return false;
                }
            }).data("autocomplete")._renderItem = function(ul, item) {
                return $("<li></li>")
                    .data("item.autocomplete", item)
                    .append("<a>" + item.label + "</a>")
                    .appendTo(ul);
            };
        });
      </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom data structure that I want to display in a PyQt
I have a form where users can enter data that ultimately would be used
I have implemented an application with Custom base adapter for display data in list
Well, I admit: I've extensively used jQuery.attr to store custom data in DOM elements
I have used custom listview and custom rating bar. If I add that custom
I have used this custom grid view in my code, and I want to
I have a custom NSActionCell used to render some parts of some of the
I have multiple custom controls used on a ASPX (and C#) page registered from
I have created a subclass of UITableViewController that is used as the custom class
A good example for what I'm looking for is the custom keyboard used by

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.