toggle checkbox in JavaScript

JavaScript
checkbox.checked = !checkbox.checked;
Source

Also in JavaScript: