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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:11:24+00:00 2026-05-21T18:11:24+00:00

I have a functioning autocomplete box on my site that I want to work

  • 0

I have a functioning autocomplete box on my site that I want to work like the ‘Tags’ autocomplete in SO.

Desired behavior

After you see a drop-down of suggestions, hitting tab or enter on the keyboard ‘accepts’ the highlighted option, adds a space, and moves the focus to the end of the line for entering the next tag.

Current behavior

After you get the drop-down, hitting tab or enter replaces the entire contents of the textbox with the current suggestion, and the cursor selects all the text (instead of inserting a space and pointing at the end of the line).

How can I achieve this response?


This is my javascript:

$(function() { 
$( "#tags-field" )
    // don't navigate away from the field on tab when selecting an item
    .bind( "keydown", function( event ) {
        if ( event.keyCode === $.ui.keyCode.TAB &&
                $( this ).data( "autocomplete" ).menu.active ) {
            event.preventDefault();
        }
    })
    .autocomplete({
      source: function( request, response ) {
        $.ajax({
            url: "<%= autocomplete_tags_name_questions_url %>",
            dataType: "jsonp",
            data: {
                featureClass: "P",
                style: "full",
                maxRows: 12,
                name_startsWith: request.term
            },
            success: function( data ) {
                alert("Hi!"),
                response( $.map( data, function( item ) {
                    return {
                        label: item.name, //+ (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
                        value: item.name
                    }
                }));
            }
        });
      },
      minLength: 2
  });
});

First, the .bind part at the top doesn’t seem to be working. How do I reconcile the code here with the code above?

  • 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-05-21T18:11:24+00:00Added an answer on May 21, 2026 at 6:11 pm

    Check out the multiple values demo.

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

Sidebar

Related Questions

I have a control that is basically functioning as a client-side timer countdown control.
I have a fully functioning program that worked. However it had two dialogs that
In my database I have certain data that is important to the functioning of
I have a snippet to create a 'Like' button for our news site: <iframe
I currently have a functioning in-house Windows Forms application which extensively uses the DataGridView
Have just started using Google Chrome , and noticed in parts of our site,
Have a n-tire web application and search often times out after 30 secs. How
Have you managed to get Aptana Studio debugging to work? I tried following this,
I have a functioning Silverlight 4 application (VS2010, SL4, WCF RIA, hosted on my
Hi Guys I have a fully functioning query, but need to do a little

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.