0

I'm trying to change the content inside of a span element. I've tried :

    <span id='spanId'> content </span>

    document.getElementById('spanId').innerHTML = blah blah

This does not work and the console returns :

'TypeError: null is not an object'

Sarah Aziziyan
  • 488
  • 7
  • 22

1 Answers1

-1

blah blah is not a recognised value. Put it in between parenthesis "..." so it's recognised as a string and don't forget your semicolon.

document.getElementById('spanId').innerHTML = "blah blah";