// thats how we set attribute. document.getElementsByTagName("H1")[0].setAttribute("class", "democlass");