Edit This Code:
<!DOCTYPE html>
<html>
<body>

<h3>A demonstration of how to access a Checkbox</h3>

Checkbox: <input type="checkbox" id="myCheck">

<p>Click the "Try it" button to check the checkbox.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    var x = document.getElementById("myCheck");
    x.checked = true;
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy