I am facing an issue with my buttons. I have one regular button and another flat button created using input elements. After every click, I want to disable the buttons for 5 seconds. The disable function is working properly for the normal button, but for the flat button, I need it to visually appear disabled by being dimmed or frozen and also disable hover effects.
function enable(id) {
document.getElementById(id).disabled = false;
}
function disable(id) {
alert(id+" is disabled for 5 seconds.")
document.getElementById(id).disabled = true;
setTimeout(function () {
enable(id);
}, 5000);
}
#buttonflat {
border: 0;
background: lightblue;
box-shadow: none;
border-radius: 0px;
color: red;
}
#buttonflat:hover {
background-color: blue;
color: white;
}
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<h1>DISABLE FLAT BUTTON</h1>
<br>
<button id="button" onClick=disable(id)> GOL_101_019_010 </button>
<br><br>
<input id="buttonflat" type="button" value="GOL_101_019_010" onClick="disable(id)" />
<br><br>
</body>
</html>