set value of element javascripr code example
Example 1: change text of element js
document.getElementById("p1").innerHTML = "New text!";
Example 2: javascript change element id
var element = document.getElementById("oldID");
element.id = "newID";