You can achieve this by attaching an event listener to all checkboxes and updating the state of the button based on whether any checkboxes are checked or not. Here's an example:
HTML:
127 chars4 lines
JavaScript:
index.tsx516 chars14 lines
In this example, we first grab references to the checkboxes and the button using the getElementById
method. We then attach click event listeners to both checkboxes and define a function updateButtonState
that sets the disabled
attribute of the button based on whether the checkboxes are checked or not.
The updateButtonState
function checks whether both checkboxes are unchecked using the !
(not) operator and sets the disabled
attribute of the button accordingly.
gistlibby LogSnag