different ways to set html attribute with javascript code example
Example 1: set attribute javascript
Element.setAttribute(name, value);
Example 2: set property dom javascrpt
document.getElementsByTagName("H1")[0].setAttribute("class", "democlass");