0

I have the error:

"Cannot read property 'innerHTML' of null" at attacked (JS.js:172).

However the concerned line is:

if (document.getElementById("enem").innerHTML  != null)

Which was made especially to solve this problem (last time I had this problem so I added this IF and it's still erroneous.

Novazzy
  • 1
  • 2

1 Answers1

0

Most probably the element enem does not exist. You should instead check if the element exists:

if (document.getElementById("enem")) {
   // element exists

} else {
   // element does not exist

}

and then you can go ahead if the element exists.

Moritz Pfeiffer
  • 447
  • 1
  • 7
  • 23