Javascript Canvas Uncaught TypeError: document.getContext is not a function
I am trying to draw a simple canvas but my browser shows an error, I am doing this by a tutorial and wondering where the mistake is. Thanks in advance <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>doc</title> <link rel="stylesheet" href="style.css"> </head> <body> <canvas id="c1"></canvas> <script src="js.js"></script> </body> </html> var canvas = document.getElementById('c1'); var ctx = document.getContext('2d'); ctx.fillRect(100,50,150,75);
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.