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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:26:36+00:00 2026-06-18T12:26:36+00:00

With reference to this question Sorting Autocomplete UI Results based on match location ,

  • 0

With reference to this question Sorting Autocomplete UI Results based on match location, there is a solution that provides for single value jQuery autocomplete but is it possible to get a similar solution for multiple values jQuery autocomplete (http://jqueryui.com/autocomplete/#multiple)?

  • 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-18T12:26:37+00:00Added an answer on June 18, 2026 at 12:26 pm

    The only difference here is that you need to make sure and call extractLast like the demo you linked to is doing. Here’s the complete code that should work with multiple values (pay particular attention to the source option):

    $("#tags")
        .on("keydown", function (event) {
            if (event.keyCode === $.ui.keyCode.TAB && $(this).data("autocomplete").menu.active) {
                event.preventDefault();
            }
        })
        .autocomplete({
            minLength: 0,
            source: function (request, response) {
                var term = $.ui.autocomplete.escapeRegex(extractLast(request.term))
                    // Create two regular expressions, one to find suggestions starting with the user's input:
                    , startsWithMatcher = new RegExp("^" + term, "i")
                    , startsWith = $.grep(source, function(value) {
                        return startsWithMatcher.test(value.label || value.value || value);
                    })
                    // ... And another to find suggestions that just contain the user's input:
                    , containsMatcher = new RegExp(term, "i")
                    , contains = $.grep(source, function (value) {
                        return $.inArray(value, startsWith) < 0 &&
                            containsMatcher.test(value.label || value.value || value);
                    });            
    
                // Supply the widget with an array containing the suggestions that start with the user's input,
                // followed by those that just contain the user's input.
                response(startsWith.concat(contains));
            },
            focus: function () {
                return false;
            },
            select: function (event, ui) {
                var terms = split(this.value);
                terms.pop();
                terms.push(ui.item.value);
                terms.push("");
                this.value = terms.join(", ");
                return false;
            }
    });
    

    Example: http://jsfiddle.net/Aa5nK/1/

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

Sidebar

Related Questions

I'm using Alberto Santini's solution to this question to get a spiral grid reference
In reference to this question: Ideal ruby project structure I noticed that appname.rb is
In reference to this question, I am facing almost the same scenario except that
With the reference of this question, I got an another solution is use $obj2
In reference to this question : What is the background that a java.net.DatagramSocket supports
This is in reference to this question - need something that is same as
In reference with this question We have a header with a date picked component
With the reference to this question:- JavaScript -Change CSS color for 5 seconds Working
Reference: This is a self-answered question. It was meant to share the knowledge, Q&A
EDIT: This question is about finding definitive reference to MySQL syntax on SELECT modifying

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.