disable submit button until checkbox is checked javascript
// Retrieve reference to checkbox
const disableCheckBox = document.getElementById("disable-checkbox");
// Retrieve reference to button
const submitButton = document.getElementById("submit-button");
disableCheckBox.addEventListener("change", (e) => {
if (e.target.checked) {
// Disable button when checkbox is selected
submitButton.disabled = true;
} else {
// Enable button when checkbox is deselected
submitButton.disabled = false;
}
});