javascript update attribute

JavaScript
var element = document.getElementById("elemId");
element.setAttribute("attributeName", "value");
Source

Also in JavaScript: