It's easy to see in Fiddler that this isn't server based, so I'm guessing that this is some sort of jQuery wizardry.


  • Detection of when auto-complete should pop up
  • Determining the list of items that can be auto-completed and displaying them
  • Finishing auto-complete (whether it be because it's no longer applicable, or an item was inserted)

There's an event handler that fires for key and click events, and checks whether the cursor is currently on a word that's preceded by an "@". If so, there's your first bullet point; if not, there's the third (note that even when an item was inserted, the cursor is still on the word, and the auto-completer is still there; otherwise you couldn't tab-cycle through the several users all starting with the same letter(s) you typed).

Regarding your second point: The chat JavaScript has a list of users it knows about, and chooses from them; the Q&A JavaScript just picks the usernames from the displayed comments. In fact, the comment auto-completer could almost 100% be implemented as a user script (and there actually was such a script, and I assume it did pretty much the same thing).

  • Many thanks. I thought it was something along these lines; it's easy to figure out what the list should be, but the logic for when to pop up/etc is helpful, thank you. – casperOne Nov 18 '11 at 15:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .