👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.

How to check / uncheck a checkbox input in pure JavaScript ?

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:

document.getElementById("myCheckbox").checked = true;
To uncheck:

document.getElementById("myCheckbox").checked = false;

More