setsttibutes javascript code example
Example 1: javascript change attribute
var element = document.getElementById("elemId");
element.setAttribute("attributeName", "value");
Example 2: setAttribute()
element.setAttribute(name, value);
element.setAttribute("style", "background-color: red;");