javascrpt change value of html attribute code example
Example: how to add attribute to selected element in javascript
// Selecting the element
var btn = document.getElementById("myBtn");
// Setting new attributes
btn.setAttribute("class", "click-btn");
btn.setAttribute("disabled", "");