plugins – prevent contact form 7 from submission on certain condition


I have a contact form 7 form and in that I have an acceptance checkbox for terms and condition and I want to make that checkbox required and add some class when checkbox is not checked and prevent form from submission.So I tried using preventDefault().

if($("#checkbox1").hasClass("check") == false){
} else {

Now addclass line is working and for some reason preventDefault() is not working it is submitting my form everytime regardless of checkbox state.I want to make that checkobx required but I dont want to use acceptance’s optional field as I dont want to disable my submit button.
Any help will be helpful and thanks in advance.

RDX023 2 months 2022-08-09T23:55:02-05:00 0 Answers 0 views 0

Leave an answer