js toggle checkbox checked code example Example: toggle checkbox in JavaScript checkbox.checked = !checkbox.checked;