开发者

<div> appears under cursor in textArea when I press ctrlKey?

开发者 https://www.devze.com 2023-03-01 01:52 出处:网络
I have the textBox(textArea) when I type something in i开发者_Python百科t an then press ctrlKey I need some little \'div\' appears under cursor. How can I manage that?? Hi I think those things can hel

I have the textBox(textArea) when I type something in i开发者_Python百科t an then press ctrlKey I need some little 'div' appears under cursor. How can I manage that??


Hi I think those things can help you:

$('#yourTextAreaID').keypress(function(e) {
   // 17 is the keyCode for crtl
   if(e.keyCode == 17) {
     $(document).mousemove(function(e){
       $('#yourDiv').postion(e.pageX, e.pageY).show;
      }); 
   }

});

First It checks if the crtl key was pressed bey de keypress event trigger on your text area. Then it gets the current mouse postion on the screen, then its sets your div to the postion of the mouse

0

精彩评论

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