0

I'm creating a website with a course and I have this line in my .js file

let submitButton = document.querySelector('#submit-button');
console.log(submitButton);

and it's supposed to show this line from my .html file

<input id="submit-button" type="submit" valid="Send Message">

The html is linked to this js but dont i have to link the js to the html? or is the error something else? because when I refresh the page the console just says 'null'

Jeremy Thille
  • 21,780
  • 7
  • 36
  • 54
st-idk
  • 1
  • 1
  • You are selecting the element before it is loaded in the document. Place the script after ``, just before the end of the `

    `

    – Jeremy Thille Apr 20 '21 at 14:12

0 Answers0