Answers for "disable button until checkbox is checked"

CSS
1

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;
  }
});
Posted by: Guest on February-08-2022
2

how to enable button after checked

<input onclick="alert('thank you for agreeing to the terms and conditions')" type="submit" name="sendNewSms" class="inputButton" id="sendNewSms" value=" i agree to the terms and conditions " />

<input type="checkbox"  onchange="document.getElementById('sendNewSms').disabled = !this.checked;" />
<!--this will only work if u click the up arrow button on the right side-->
Posted by: Guest on June-23-2021
1

disable checkbox click event

pointer-events:none
Posted by: Guest on July-16-2020

Code answers related to "disable button until checkbox is checked"

Browse Popular Code Answers by Language