Contact Form 7
make field required using checkbox (1 post)

  1. shuvra124
    Posted 3 years ago #

    is there any way that i can make text field required when checkbox checked and make it non required when checkbox unchecked? i think it can be done by jQuery but i can't find any way to do it :( if any1 have idea plz help me. i try like this

    jQuery("#addReq span input").click(function() {
    	if(jQuery(this).is(":checked")) {
    		jQuery(".your-address input").addClass("wpcf7-validates-as-required");
    		jQuery(".your-address input").attr("title", "Address*");
    	else {
    		jQuery(".your-address input").removeClass("wpcf7-validates-as-required");
    		jQuery(".your-address input").attr("title", "Address");


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic