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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:01:42+00:00 2026-06-05T21:01:42+00:00

I have an app where the user types a word and an autocomplete appears.

  • 0

I have an app where the user types a word and an autocomplete appears. When the select the appropriate autocomplete, it’s added to the input field and the user keeps typing. I would very much like to highlight that word in the input box (not in the autocomplete list) and have the rest of the words in the box not appear highlighted, but I can’t find any examples of this.

$(searchBoxId).autocomplete({
    source:      keys,
    delay:       0,
    selectFirst: true,
    select:      function(event, ui) {
        var TABKEY = 9;
        this.value = ui.item.value;

        if (event.keyCode == TABKEY) {
            event.preventDefault();
            this.value = this.value + " ";
            // XXX something goes here?
            this.focus();
        }

        return false;
    },
    autoFocus: true,
    minLength: 2
});

This is jquery 1.8.20. By “highlight”, I mean “able to make it look visually distinct in a manner similar to how Facebook or Google+ can highlight usernames”.

  • 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-05T21:01:45+00:00Added an answer on June 5, 2026 at 9:01 pm

    Since you’re already using jQuery, you might want to look at using something like jQuery Tags.

    It supports autocomplete and does the data-differentiation you’re looking for.

    The basic concept is though that you take your text box and make it a div with the contenteditable flag set. Listen for keypress events — specifically the space bar and the enter key. When they’re hit, you grab the most recently entered text (that already isn’t “tagged”) and create a <div> and append it.

    Or just use the plugin…

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

Sidebar

Related Questions

I have this text input field on a web page. User types in item
I have a search textbox on silverlight app where user types in search term
in my app in have an edit box when the user types a web
in my app i have two editbox in which the user types the email
Would this be possible? The app will have a button and a Text Field
I have an app with 2 user levels; Superuser, and Staff. Superuser will login
I have an app where the user presses a button and a custom spinner
I have an app that requires user to register. I've got the app conected
lets say i have app id, app secret id and user uid now i
Currently I have this code var App = Ember.Application.create(); App.user = Ember.Object.create({ people: customers

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.