how to add attribute to selected element in javascript

JavaScript
	// Selecting the element
    var btn = document.getElementById("myBtn");
	
    // Setting new attributes
    btn.setAttribute("class", "click-btn");
    btn.setAttribute("disabled", "");
Source

Also in JavaScript: