Skip to content

Mouse cursor disaappears on keypress event in Jquery

I am using arrow keys to move an object in my code. Everything works fine except that the mouse cursor disappears when I press any of the arrow keys. How can I make the cursor stay visible? I am using this code check for arrow keys pressed.

$(document).ready(function() {  
    $(document).keydown(function(event) {
        checkKeys(event);
    }).keyup(function(event) {
        keyUp(event);
    });  
});

Answer

That’s browser behavior (maybe even OS behavior!), you probably won’t find a way to stop it with javascript.

It’s intended to hide the cursor so you can see what you’re typing. Try it on any website, keystrokes always make the mouse cursor go away.