How to Check checkbox is checked or not?

By using the function we can know if the checkbox is selected or checked or not. then depending on the result we can perform operations.

function is_checkbox_selected(element){

    if(element.checked) {
        // CheckBox is checked
    }else {
        // Checkbox is not checked


The Html code: Call the above function from on check or on click from javascript or Jquery.

<input type="checkbox" name="accept" value="1" onclick="is_checkbox_selected(this)" >

Leave a Comment