check uncheck vanila js

JavaScript
//Check
document.getElementById('checkbox').setAttribute('checked', 'checked');

//UnCheck
document.getElementById('chk').removeAttribute('checked');

Source

Also in JavaScript: