how to change the attribute value in javascript code example
Example 1: javascript update attribute
var element = document.getElementById("elemId");
element.setAttribute("attributeName", "value");
Example 2: html change attribute
element.setAttribute(name, value);
var d = document.getElementById("d1");
d.setAttribute("align", "center");
Example 3: set attribute in javascript
var a = document.getElementById("id");
a.setAttribute("style", "visibility:hidden;");
Example 4: set attribute javascript
Element.setAttribute(name, value);