ContactForm7 – Check if Checkbox is Checked

I’m stuck on how to check whether or not a checkbox has been selected using jQuery. Basically, if the checkbox is checked then I need it to run a function.

In the WordPress post, I only have to use the shortcode which is using this id:

 [contact-form-7 id="78" title="BusinessForm"]

however, it is ouputting this as the HTML:

<span class="wpcf7-form-control-wrap sameAddress">
    <span class="wpcf7-form-control wpcf7-checkbox sameAddress" id="sameAddress">
        <span class="wpcf7-list-item first last">
            <input type="checkbox" name="sameAddress[]" value="Yes">
                <span class="wpcf7-list-item-label">Yes</span>

and here is the jQuery that I am using:

$(input[value='sameAddress[]']).change(function() {

    var alreadyChecked = $(this).hasClass('alreadyChecked');

    if (alreadyChecked) {
        alert('This does not have the class');  
    } else {
        alert('This has the class, yay!!!!! ');


Can someone help me refine this and make it run a function/alert when the checkbox is selected? Thanks in advance.

edit: Here is a Fiddle:

Read more here: ContactForm7 – Check if Checkbox is Checked

Leave a Reply

Your email address will not be published. Required fields are marked *