Reputation: 21
All I want to do is start using the canvas but I continue to get this error. I have seen many people telling others to put the canvas tags before the script tags and I have done this and it hasn't fixed the problem. HTML:
<!DOCTYPE html>
<html>
<head>
<title>Cross Stats Graph</title>
</head>
<body>
<canvas> id="chart" width="720" height="720"</canvas>
<script type="text/javascript" src="sketch.js"></script>
</body>
</html>
Javascript:
var canvas = document.getElementById("chart").getContext("2d");
Upvotes: 1
Views: 56
Reputation: 1120
You're id is not in the html tag
<canvas id="chart" width="720" height="720"></canvas>
Should fix your problem
Upvotes: 1