JSFiddle - React, Tailwind, and code Playground
by maximos
HTML
<input id="check" type="checkbox"/>
<input id="btn1" type="button" value="enable" />
<input id="btn2" type="button" value="disable" />
JavaScript
function enable() {
var x = document.getElementById("check");
alert(x.getAttribute("disabled"));
x.removeAttribute("disabled", "false");
alert(x.getAttribute("disabled"));
}
function disable() {
var x = document.getElementById("check");
alert(x.getAttribute("disabled"));
x.setAttribute("disabled", "true");
alert(x.getAttribute("disabled"));
}
document.getElementById("btn1").addEventListener("click", enable);
document.getElementById("btn2").addEventListener("click", disable);