Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

366
Views
innerHTML error in syntax not working; Uncaught TypeError: Cannot set properties of null (setting 'innerHTML')

For some reason I am keep on getting a syntax error from this "innerHTML", can someone help me?

HTML CODE:

<div id="ID"></div>

JavaScript CODE:

document.getElementById("ID").innerHTML = "Test";

Syntax Error: Uncaught TypeError: Cannot set properties of null (setting 'innerHTML')

I am trying to make the div respond with a "Test" using "innerHTML" and "getElementById" but the syntax error is getting in the way.

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

The error means that js not found with the selector ID. You need ID as a selector. Take a look:

document.getElementById("ID").innerHTML = "Test";
<div id="ID">Hello</div>

about 4 years ago · Juan Pablo Isaza Report

0

The error refers to the fact that document.getElementById("ID") is invalid. Meaning that "ID" is not existing. In your HTML code there needs to be an object with the id="ID".

about 4 years ago · Juan Pablo Isaza Report

0

Running getElementById on an ID that isn't currently existing on the webpage will give you this error, if you are working on a project with multiple scenes and you try to call this for an element on a scene that is NOT currently shown on the screen it will error out with this error.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!