<div> appears under cursor in textArea when I press ctrlKey?
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
精彩评论