changing attributes using javascript

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

Also in JavaScript: