I would like to enable/ disable a button when someone presses the terms checkbox and I created the following function:
const enableButton = (checkBox: HTMLInputElement ) => {
var submitButton = document.getElementById("submit_button");
var isChecked = checkBox.checked;
if(isChecked) {
submitButton!.disabled == false;
} else {
submitButton!.disabled == true;
}
}
I am doing it with React and TypeScript. When I change it to the following, I get the error that you can see in the description. In general I think I am missing something with assigning types etc. Whatever I do, when I fix something I get different errors.
var submitButton: HTMLButtonElement = document.getElementById("submit_button");