WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. shuvra124
    Member
    Posted 2 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");
    	}
    });

    http://wordpress.org/extend/plugins/contact-form-7/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic