append text to div in javascript 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: JavaScript append HTML
let app = document.querySelector('#app');
app.append('append() Text Demo');
console.log(app.textContent);