I have set up a canvas in HTML5 exactly right (I think) I've got an error:
I've previously made a canvas game, and I have copied and pasted the code multiple times, It looks right to me, I've googled the HTML canvas set up, I have got the same answer, please help!
<html>
<head>
</head>
<body>
<script src="jumpMan.js"></script>
<canvas width="1000px" height="450px" id="canvas"></canvas>
</body>
</html>
//jumpMan.js
var canvas = document.getElementById("canvas"),
ctx = canvas.getContext("2d");
ctx.fillRect(50,50,50,50);
My Error:
Uncaught TypeError: Cannot read property 'getContext' of null at jumpMan.js:3 (anonymous) @ jumpMan.js:3