How can I validate google reCAPTCHA v2 using javascript/jQuery?

This Client side verification of reCaptcha – the following worked for me :

if reCaptcha is not validated on client side grecaptcha.getResponse(); returns null, else is returns a value other than null.

Javascript Code:

var response = grecaptcha.getResponse();

if(response.length == 0)
    //reCaptcha not verified

    //reCaptch verified

Leave a Comment