skip to Main Content

This is the code I am using right now, for cf7 wordpress, but when I load the page it is checking it but after fully load of page it is going to uncheck again.
I just want to get the checkbox checked by default.
Here is the code,

jQuery(document).ready(function ($) {
 $('#cus_checkbox').find('input').prop( 'checked', true );
 });

Any help on this?

2

Answers


  1. Actually, my reputation is not enough for comment so I am writing as an answer

    try by doing this

    <input type="checkbox" id="cus_checkbox" checked="true" />
    
    Login or Signup to reply.
  2. In order to have a "registered" answer here I repeat my comment again as an answer:

    In order to get the contactform 7 checkbox checked by default you should specify it when you define the cf7 element by adding default:1:

     [checkbox* cus_checkbox  default:1 "some label text"]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search