Search the blog

If you are using Google reCAPTCHA to prevent spam then you want to check it has been actioned before the form is submitted. Here is how you do it:

$('form.contact').on('submit', function() {

	var $form = $(this);

    // Do whatever other validation you want here

	var recaptcha = $form.find('.g-recaptcha-response').val();

    if (recaptcha === '') {

       alert('Please confirm you are human!');

	   return false;

    }

    return true;

});
Tim Bennett is a freelance web designer from Leeds. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.