xxxxxxxxxx
//to enable btn
let temp
temp = document.getElementById("saveBtnId") as HTMLButtonElement
if (temp) {
temp.removeAttribute('disabled');
}
//disable
if (temp) {
temp.disabled = true;
}
xxxxxxxxxx
//disable the button
document.getElementById(BUTTON_ID).disabled = true;
//reable the button
document.getElementById(BUTTON_ID).removeAttribute('disabled');
xxxxxxxxxx
document.addEventListener("DOMContentLoaded", function(event) {
document.getElementById("Button").disabled = true;
});
xxxxxxxxxx
// Enabling a disabled button to enable it again
document.querySelector('#button').disabled = false;
xxxxxxxxxx
// Disabling a button
document.querySelector('#button').disabled = true;
xxxxxxxxxx
// Get the button element using its id or any other method
const button = document.getElementById('myButton');
// Disable the button
button.disabled = true;