Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Disable button if one of the checkboxes are not checked

const checkBoxes = document.querySelectorAll('input[type="checkbox"]');
const submitButton = document.getElementById('startusing-button');
checkBoxes.forEach((cb) => {
  cb.addEventListener('change', checkButtonStatus);
});
function checkButtonStatus() {
  const checkedCount = [...checkBoxes].filter((cb) => cb.checked);
  submitButton.disabled = checkedCount.length !== checkBoxes.length
}
checkButtonStatus();
Comment

Disable button if one of the checkboxes are not checked

<input type="checkbox" id="document-checkboxid" />
<input type="checkbox" name="VAT" id="accepttermsandcond-checkbox" />
<button type="button" id="startusing-button">CreateSubscription</button>
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery element width 
Javascript :: converting strings to numbers 
Javascript :: how to set env variables in js 
Javascript :: before page load javascript 
Javascript :: node require module 
Javascript :: local database with javascript 
Javascript :: stop keyframe animation javascript 
Javascript :: react lazy import non default 
Javascript :: get current time in different timezone javascript 
Javascript :: how to merge two objects into one in javascript 
Javascript :: antd datepicker set min max 
Javascript :: concat js mdn 
Javascript :: laravel send http post request json 
Javascript :: react download file from express res.download 
Javascript :: js send file as form input 
Javascript :: mongoose update and return new 
Javascript :: vue js default props 
Javascript :: inc a value mongoose 
Javascript :: upload image react 
Javascript :: prettier vscode settings 
Javascript :: avascript regex email 
Javascript :: how to count specific letters in string js 
Javascript :: react pass props to child 
Javascript :: js execute string 
Javascript :: canactivate angular 
Javascript :: alphabet to number javascript 
Javascript :: react native getstream 
Javascript :: how to find all elements starting with class jquery 
Javascript :: jquery select first matching element 
Javascript :: regex find first instace 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =