Checkbox checked validation using JavaScript

You can check whether a checkbox is checked or not using checkbox_elemnt.checked attribute.

Here is an example:

Here is the JavaScript code for easy reference:

function validateForm(form)
{
    console.log("checkbox checked is ", form.agree.checked);
    if(!form.agree.checked)
    {
        document.getElementById('agree_chk_error').style.visibility='visible';
        return false;
    }
    else
    {
        document.getElementById('agree_chk_error').style.visibility='hidden';
        return true;
    }
}