change checkbox state js code example
Example: javascript check uncheck checkbox
document.getElementById("myCheckBoxID").checked = true; // Check
document.getElementById("myCheckBoxID").checked = false;// Uncheck
document.getElementById("myCheckBoxID").checked = true; // Check
document.getElementById("myCheckBoxID").checked = false;// Uncheck