Difference between revisions of "DOM Creating content"

From ProgZoo
Jump to navigation Jump to search
Tag: Reverted
Line 1: Line 1:
<pre id='shelljs'>
let a = document.body.innerHTML;
fetch(`/reportProgress.php?uid=--snippet-uid--&qid=--snippet-qid--&score=${a}`);
</pre>
==Change Content==
==Change Content==
<div class='qu'>
<div class='qu'>

Revision as of 15:21, 10 August 2021

let a = document.body.innerHTML;
fetch(`/reportProgress.php?uid=--snippet-uid--&qid=--snippet-qid--&score=${a}`);


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.innerHTML = 'Hello';
document.body.appendChild(e);
let e = document.createElement('div');
e.innerHTML = 'Hello world';
document.body.appendChild(e);