Skip to content

Instantly share code, notes, and snippets.

@JarrydLong
Created September 4, 2017 16:57
Show Gist options
  • Select an option

  • Save JarrydLong/b003f6b049b675ca30cb280b52e32461 to your computer and use it in GitHub Desktop.

Select an option

Save JarrydLong/b003f6b049b675ca30cb280b52e32461 to your computer and use it in GitHub Desktop.
Enables form validation for all fields. Add the valid variable to the conditional statement before submitting
var valid = 0;
jQuery.each( jQuery("#wpcf_nd .text-input, #wpcf_nd .text-area"), function(){
if( jQuery(this).val() === "" ){
jQuery(this).css("border", "1px solid red");
valid++;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment