Get Input Checkbox - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Checkbox


The Input object represents an HTML <input> element with type="checkbox".

You can access an <input> element with type="checkbox" by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
Checkbox: <input type="checkbox" id="myCheck">

<button onclick="myFunction()">Test</button>

function myFunction() {//from w w w.j  av  a2s  .  co m
    var x = document.getElementById("myCheck");
    x.checked = true;
    x.disabled = true;


Related Tutorials