Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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;
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: devtools failed to load sourcemap when debugging react native 
Javascript :: alert.alert react native style 
Javascript :: audio in react 
Javascript :: bodyparser purpose 
Javascript :: random color code js 
Javascript :: how to generate random string in javascript 
Javascript :: async storage get item 
Javascript :: javascript rotate image canvas 
Javascript :: how get checkbox if checked in jquery 
Javascript :: vscode regex replace only group 
Javascript :: react native scrollview detect end 
Javascript :: this is a problem related to network connectivity npm 
Javascript :: swiftyjson 
Javascript :: remove element from dictionary javascript 
Javascript :: get size of json object 
Javascript :: destructuring dynamic properties 
Javascript :: show ajax error wordpress 
Javascript :: javascript string change character at index 
Javascript :: jquery remove items from dropdownlist 
Javascript :: postman test check response status 
Javascript :: download text file javascript 
Javascript :: javascript classlist 
Javascript :: vue shortcut to create component 
Javascript :: //disable-linter-line 
Javascript :: javascript random word 
Javascript :: save text to file nodejs 
Javascript :: es6 loop through object 
Javascript :: refresh after delete in express 
Javascript :: js message timeout 
Javascript :: javascript onmouseover change image 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =