Skip to content
Advertisement

Change mouse cursor in Javascript or jQuery

How can I change the mouse cursor in Javascript or in jQuery ? I know it’s a very classic question, but very strangely this JSFiddle doesn’t work : http://jsfiddle.net/2Qffw/.

Here is the code :

$('body').css('cursor','pointer');

document.body.style.cursor = "pointer";

Advertisement

Answer

Do it in both html and body:

$('html,body').css('cursor','crosshair');

http://jsfiddle.net/2Qffw/3/

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement