query selector set attribute html javascript code example
Example 1: javascript change attribute
var element = document.getElementById("elemId");
element.setAttribute("attributeName", "value");
Example 2: html change attribute
element.setAttribute(name, value);
var d = document.getElementById("d1");
d.setAttribute("align", "center");