Jump to content

Why variable assigned by getElementbyID undefined


Joe_IBM
 Share

Recommended Posts

When Javascript runs, it only has access to the part of the page that has been loaded. Content below it does not exist yet. You can either move your code to the bottom of the body or have a window DOMContentLoaded event to run the code after the page has finished loading.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...