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

136
Views
GetElementById Returns Null Even Though Its Formatted Correctly

I have an html file whos body looks like this:

<body>
<header>
    <h1></h1>
</header>
<main>
    <div id="menu">
        <div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
</main>
<footer>
    <p></p>
</footer>

<script src="js/script.js"></script>

</body>

the linked js file has this near the beginning:

var received = document.getElementById("menu");

the script is included at the bottom of the page and ive even tried windows onload, but no matter what, the javascript debugger shows "received" being null after attempting to get the element.

This looks like a repost but from what I can tell, I already formatted it correctly and implemented most popular fixes before looking for help.

about 4 years ago · Juan Pablo Isaza
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!