how add text to element in javascript

104

how add text to element in javascript -

var paragraph = document.getElementById("p");

paragraph.textContent += "This just got added";

how add text to element in javascript -

var p = document.getElementById("p")
p.innerText = p.innerText+" And this is addon."

how add text to element in javascript -

 document.getElementById("p").textContent += " this has just been added";

Comments

Submit
0 Comments