javascript checkbox checked

JavaScript
if(document.getElementById('on_or_off_checkbox').checked) {
    //I am checked
}else{
	//I am not checked
}Check If Checkbox Is Checked Javascript<input type="checkbox">/*Have a HTML checkbox set to any Id of your choice-Example:
<input type="checkbox" id="test">
Also make it send for a function using onclick="testfunction()"
You can use any name for the function.*/
function testfunction() {
             var x = document.getElementById("test").checked;
             document.getElementById("text").innerHTML = x;
                }
/*Line 6 is testing a checkbox with an Id of "test" to see if
it's checked, it will send either a "true" or "false" output.
Line 7 is taking a text element from HTML with an Id of "text",
it takes that text and sets it to the variable "x". Since "x"
is set to "true" for the example, it will turn any text element
with the Id to say "true".*/
Source

Also in JavaScript: