Changing the mouse cursor in javascript or jQuery

How can I change the mouse cursor in Javascript or in jQuery? I know this is a very classic question, but it is very strange that JSFiddle does not work: http://jsfiddle.net/2Qffw/ .

Here is the code:

$('body').css('cursor','pointer'); document.body.style.cursor = "pointer"; 
+8
javascript jquery cursor
source share
3 answers

Do this in both html and body :

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

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

+18
source share

It works, but you had an empty body.

http://jsfiddle.net/z6mhH/

HTML

 <body> asdasdasdasdads </body> 

Js

 document.body.style.cursor = "crosshair"; 
+7
source share
 document.getElementById("mydiv").style.cursor="move"; 
+1
source share

All Articles