javascript change element attributres code example
Example 1: html change attribute
element.setAttribute(name, value);
var d = document.getElementById("d1");
d.setAttribute("align", "center");
Example 2: set attribute javascript
Element.setAttribute(name, value);