if checked add unchecked javascript example
Example 1: oncheck checkbox javascript
<input type='checkbox' onchange='handleChange(this);'> Checkbox
function handleChange(checkbox) {
if(checkbox.checked == true){
document.getElementById("submit").removeAttribute("disabled");
}else{
document.getElementById("submit").setAttribute("disabled", "disabled");
}
}
Example 2: how to check if input is checked javascript
const cb = document.getElementById('accept');
console.log(cb.checked);