1

I need to take the text of an element from my DOM and pass it to a function. but I get an error on the line below

const status =  document.getElementById("word").innerText

the error is : Cannot read properties of null (reading 'innerText')

I am certain that the element with "word" id is not null, I can't find what the problem is or where the null comes from

Mahshad
  • 89
  • 3
  • 3
    See [Why does jQuery or a DOM method such as getElementById not find the element?](https://stackoverflow.com/q/14028959) - either you'll find the answer there or you need to provide more information and a [mcve]. – VLAZ Apr 22 '22 at 19:31
  • Can you share your html? – Yedidya Rashi Apr 22 '22 at 19:40

0 Answers0