开发者

Binding to special character in a message - a la Facebook

So you know how in Facebook when you type开发者_Go百科 a special character in a post, it brings up (right below your cursor), a list of people's names that start with or feed off of the letters you are typing in at the time?

I would like to achieve a similar functionality, however the source of data won't be peoples names. Actually the source of data really isn't important right now, I'm just trying to figure out the best way to implement that technology.

Is there a plugin for this or is this something I'm going to have to do myself? I was thinking if there wasn't a plugin, to bind (in JQuery), to that specific special character keypressed event, and then basically use a tooltip plugin that comes into focus instead of the text field the user was writing in, and fill the tooltip with the things from my Data Source, until they hit 'Esc' to exit, or 'Enter' to select a choice or something.

Any tips/ideas/suggestions?

Thanks.


jQuery UI autocomplete.


I would indeed go with the keypressed event in JQuery and detect the key. If it's the one you need, show the tooltip.

$("#target").keypress(function(e) {
   var code = (e.keyCode ? e.keyCode : e.which);
   if (code == <your_key> {

   }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜