1var element = document.getElementById("elemId");
2element.setAttribute("attributeName", "value");
1element.setAttribute(<name>, <value>);
2// ex
3var aElement = document.querySelector("a");
4aElement.setAttribute("href", "https://isitchristmas.com/");
5// same as <a href="https://isitchristmas.com/"></a>
1element.setAttribute(name, value);
2
3
4var d = document.getElementById("d1");
5d.setAttribute("align", "center");
1element.setAttribute(name, value);
2element.setAttribute("style", "background-color: red;");
1//Fetch id from html
2var a = document.getElementById("id");
3
4//variable.setAttribute("Attributes","Properties:Values")
5a.setAttribute("style", "visibility:hidden;");
6