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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:09:17+00:00 2026-05-24T23:09:17+00:00

While typing into a textarea, I’d like certain character combinations to trigger an inline,

  • 0

While typing into a textarea, I’d like certain character combinations to trigger an inline, popup “select box”, just like in Facebook when you tag your friends in posts/comments.

For example, if the user were to type [friend:m they’d get a popup, with a list of their friends that start with m. As they continued typing, they’d get more narrow results… just like auto-complete.

I’d like to have other triggers too… [place: or [info: , etc…

I’ve been able to get up to where I can detect the triggers, but not experienced enough with Js/jQuery to finish this off. ;(

Here’s what I’ve got:

var totalcount=0;

$('#Data').keyup(function (){
    var arr = $(this).val().split(" ");
    var matchitems = count('[place:', arr);

    if(matchitems > totalcount) {
        $('#Data').val($('#Data').val()+'foobar');
        totalcount = matchitems;
    }
    if(matchitems < totalcount) {
        totalcount = matchitems;
    }
});

function count(value, array) {
    var j=0;
    for(var i=0; i < array.length; i++) {
        if(array[i] == "[place:") {
            j++;
        }
    }
    return j;
}

This works, when I type [place: it appends “foobar” to textarea. Now I’m trying to take it further; to read the trigger, and then do a JSON call to create the popup list. How do I go about doing this? Know of any tutorials out there that cover this? Thanks!

  • 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-24T23:09:18+00:00Added an answer on May 24, 2026 at 11:09 pm

    Here’s an example of the behavior you’re looking for

    example jsfiddle

    I’ve actually done something similar, I modified it to fit what you’re trying to do.

    • It looks for a matching [type: where type is friend, place, info etc
    • Loads the results
    • Handles up/down keys to toggle between results, enter to select (or mouse click), esc hides the auto complete results
    • Sets the input value based on selection made from auto complete
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When you enter a space ' ' while typing into cin, it will take
I ran into this question while typing man 2 open . It says that
I want to load the default text into textarea like this Usually we can
Sorry answer found while typing I am trying to connect to an external webservice
Possible Duplicate: What does a type followed by _t (underscore-t) represent? While typing in
i looking for a way to preview the text while im typing in a
I have a Listbox where all cells are editable. While the user is typing
IE8 has a known bug (per connect.microsoft.com ) where typing or pasting text into
I frequently make mode errors while using vim, i.e. I'll start typing text while
Every once in a while I find myself typing a one-off script to import

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.