JSFiddle - React, Tailwind, and code Playground
by HappyFone
HTML
<button class="theButton" id="theButton">
Click to disable
</button>
CSS
.theButton {
display: inline-block;
width: 540px;
margin: 20px 0 10px;
padding: 12px;
background-color: #b6adb4;
border-radius: 2px;
border: 0px;
text-align: center;
color: #fff !important;
text-decoration: none !important;
font-size: 16px;
font-family: 'Rubik', sans-serif;
cursor: pointer;
}
.theButton:disabled {
display: inline-block;
width: 540px;
margin: 20px 0 10px;
padding: 12px;
background-color: #b6adb4;
border-radius: 2px;
border: 0px;
text-align: center;
color: #fff !important;
text-decoration: none !important;
font-size: 16px;
font-family: 'Rubik', sans-serif;
opacity: 0.5;
}
JavaScript
/* ignore top lines */
document.getElementById("theButton").addEventListener("click", myFunction);
/* ignore top lines */
function myFunction() {
document.getElementById("theButton").disabled = true;
}