javascript dom setattribute code example
Example 1: javascript change attribute
var element = document.getElementById("elemId");
element.setAttribute("attributeName", "value");
Example 2: set property dom javascrpt
document.getElementsByTagName("H1")[0].setAttribute("class", "democlass");