👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.
hot to enable / disable checkbox input vanilla js
To check or uncheck a checkbox or a radio button, use the checked
property of the concerned element by assigning a boolean value (true
or false
) :
To check:
To uncheck:document.getElementById("myCheckbox").checked = true;
document.getElementById("myCheckbox").checked = false;