Joe_IBM Posted March 20, 2019 Share Posted March 20, 2019 Why I get in the following code always the value "undefined" regardless what I type into the val field? testval.html Link to comment Share on other sites More sharing options...
Ingolme Posted March 25, 2019 Share Posted March 25, 2019 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now