Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triggering Autocomplete with @

Tags:

javascript

I am mostly a backend developer. And very new to javascript. So pardon my dumb question, but is there a way to trigger autocomplete when the user types '@' in a textfield. Like how it does in twitter.

like image 874
Jonathan Avatar asked Dec 08 '25 13:12

Jonathan


2 Answers

Take a look at onkeyup if you are using straight javascript. If you are using jQuery, try keyup.

From there, you can check to see if the user entered '@' and then make your auto-complete .

like image 94
MKS Avatar answered Dec 10 '25 04:12

MKS


Got two answers for you:

  1. I think this blog post has what you need: Triggered @mention Autocomplete like Facebook, Twitter and Google+
    Github repo: https://github.com/Hawkers/triggeredAutocomplete

  2. Also a similar question: Twitter-style autocomplete in textarea

like image 30
zengr Avatar answered Dec 10 '25 04:12

zengr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!