mdn / beginner-html-site-scripted

A single-page website created to help complete beginners learn HTML with JS added to help beginners learn JavaScript. Supports https://developer.mozilla.org/en-US/Learn/Getting_started_with_the_web/JavaScript_basics
https://mdn.github.io/beginner-html-site-scripted/
Creative Commons Zero v1.0 Universal
262 stars 296 forks source link

TypeError: myImage is null #6

Closed ovirchenko closed 6 years ago

ovirchenko commented 6 years ago

I'm trying to learn JS basics, however also got stuck with this error TypeError: myImage is null (as it was mentioned in closed issue) in the line: myImage.onclick = function() {

At the same time, if I put the script just in js console in browser, it works. Maybe it's connected with Visual Studio Code, I'm writing in. I've tried both relative and absolute paths.

ovirchenko commented 6 years ago

Found the problem) Put mistakenly <script src="scripts/main.js"></script> before </head>