js append html code example
Example 1: js add more text to element
document.getElementById("p").textContent += " This is the text from javascript.";
<p id ="p">This is the text from HTML.</p>
Example 2: .append js
let parent = document.createElement("div")
parent.append("Some text")
console.log(parent.textContent)
Example 3: how to appendChild in the begin of the div javascript
var element = document.getElementById("div1");
element.insertBefore(para, element.firstChild);
Example 4: how to append in javascript
var list=[1, 2, 3, 4, 5];
list.push(6);
Example 5: JavaScript append HTML
let app = document.querySelector('#app');
app.append('append() Text Demo');
console.log(app.textContent);
Example 6: prepen an element js
document.createElement("div").prepend(span);