I want to hide the cursor for my browser based game. I don't want to do this until the game starts.
I have this in CSS: * { cursor: none }
. How would I do this in JavaScript? My target browser is Chrome and only Chrome.
I want to hide the cursor for my browser based game. I don't want to do this until the game starts.
I have this in CSS: * { cursor: none }
. How would I do this in JavaScript? My target browser is Chrome and only Chrome.
You can do
document.body.style.cursor='none';
A note about your CSS : it's better to avoid as much as possible the *
selector, especially when you can just set a style to the body.
<div id="nocursor"></div>
<script type="text/javascript">
document.getElementById('nocursor').style.cursor = 'none';
</script>
It still uses css, but I assume that this is what you were looking for.