DOM Creating content

From ProgZoo
Revision as of 16:12, 10 August 2021 by Andr3w (talk | contribs) (Created page with "==Change Content== <div class='qu'> You can create a div element an set the content. We use the document method '''createElement''' and the DOM node method '''appendChild'''...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Change Content

You can create a div element an set the content.

We use the document method createElement and the DOM node method appendChild

let e = document.createElement('div');
e.body.innerHTML = 'Hello';
document.body.appendChild(e);
let e = document.createElement('div');
e.body.innerHTML = 'Hello world';
document.body.appendChild(e);