change html attribute with javascript code example
Example 1: set attribute javascript
Element.setAttribute(name, value);
Example 2: javascript change element id
var element = document.getElementById("oldID");
element.id = "newID";
Element.setAttribute(name, value);
var element = document.getElementById("oldID");
element.id = "newID";