You have to place the hello
div before the script, so that it exists when the script is loaded.
More Related Contents:
- Checkbox hidden on body load [closed]
- Executing elements inserted with .innerHTML
- Show/hide ‘div’ using JavaScript
- Difference between innerText, innerHTML and value?
- How to run a function when the page is loaded?
- Why is “element.innerHTML+=” bad code?
- iFrame src change event detection?
- How do I call a JavaScript function on page load?
- Advantages of createElement over innerHTML?
- Execute write on doc: It isn’t possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
- Can scripts be inserted with innerHTML?
- ‘onload’ handler for ‘script’ tag in internet explorer
- Javascript read file without using input
- JavaScript get TextArea input via .value or .innerHTML?
- React.js: Set innerHTML vs dangerouslySetInnerHTML
- What html tags support the onload/onerror javascript event attributes?
- Change label text using JavaScript
- Setting innerHTML: Why won’t it update the DOM?
- Javascript Iframe innerHTML
- Difference between onload() and $.ready?
- Add inline style using Javascript
- Recall Tampermonkey script when page location changes
- iFrame onload JavaScript event
- Javascript before onload?
- When to use “window.onload”?
- Alternative for innerHTML?
- Async-loaded scripts with DOMContentLoaded or load event handlers not being called?
- Is bubbling available for image load events?
- innerHTML removes attribute quotes in Internet Explorer
- addEventListener gone after appending innerHTML