DOM Creating content: Difference between revisions

From ProgZoo
Jump to navigation Jump to search
No edit summary
Tag: Manual revert
No edit summary
Line 1: Line 1:
<pre id='shellbody' data-qtp='DOM'></pre>
==Change Content==
==Change Content==
<div class='qu'>
<div class='qu'>

Revision as of 21:12, 10 August 2021


1) Change Content

You can create a div element an set the content.

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

Input


Output

let e = document.createElement('div');
e.innerHTML = 'Hello';
document.body.appendChild(e);
let e = document.createElement('div');
e.innerHTML = 'Hello world';
document.body.appendChild(e);
Served by: dill at 2025-06-19T21:55

Navigation menu