You have to put this in a document
load
event. The DOM hasn’t gotten to abc
by the time the script is executed.
More Related Contents:
- Do DOM tree elements with IDs become global properties?
- How to pick element inside iframe using document.getElementById
- Getting the parent div of element
- Write tags in HTML and print
- Why is null an object and what’s the difference between null and undefined?
- Why don’t we just use element IDs as identifiers in JavaScript?
- How to prevent Unicode characters from rendering as emoji in HTML from JavaScript?
- Get HTML5 localStorage keys
- What is CDATA in HTML? [duplicate]
- Adding additional data to select options using jQuery
- HTML5 dragleave fired when hovering a child element
- localStorage access from local file
- :touch CSS pseudo-class or something similar?
- Open link in iframe [closed]
- Is it possible to play HTML5 video in reverse?
- d3.js – v3 and v4 – Enter and Update differences
- Load event not fired on Safari when reloading page
- Multiple Select limit number of selection
- “getElementById not a function” when trying to parse an AJAX response?
- Can you use both the async and defer attributes on a HTML tag?
- How to vertically align all text in CSS?
- How can I stop an onclick event from firing for parent element when child is clicked?
- getting mouse position with javascript within canvas
- Maximum item size in IndexedDB
- Is there a way to get innerText of only the top element (and ignore the child element’s innerText)?
- document.activeElement returns body in onblur handler
- javascript close current window
- How does HTML tags work inside script tag?
- onclick calling hide-div function not working
- Chrome Extension get selected text