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";
Do it in both html
and body
:
$('html,body').css('cursor','crosshair');
http://jsfiddle.net/2Qffw/3/
It does work, but you had an empty body.
http://jsfiddle.net/z6mhH/
HTML
<body>
asdasdasdasdads
</body>
JS
document.body.style.cursor = "crosshair";
document.getElementById("mydiv").style.cursor="move";
in Javascript, you can do it, you just have to use void 0;
at the end of document.body.style.cursor = "crosshair";
, so at the end, it should look like this: document.body.style.cursor = "crosshair"; void 0;
.