Google reCAPTCHA code with jquery validation - Mostlikers

22 September, 2015

Google reCAPTCHA code with jquery validation

Today we are going learn about how to implement google Captcha to your html form. Before going this tutorial you should know about Why we need use ? google reCAPTCHA. Here i have used Jquery validation library to checking the Html form elements.

Google reCAPTCHA code with jquery validation

Live Demo            Download

Get reCaptcha data key 

Get stared to Fill the form information and your domain name without http// or https//. if you want check that code to your localhost server , Just add domain like

After submit the form google will review your request and it will generate one new site key and secret key.  

Google reCAPTCHA code with jquery validation

Follow the bleow Html element code and Jquery functions.


Contains html code id="keycode" hidden field store the google hash key value.

<script src=""></script>    
<script src="">    
<script src=''></script>
    <form method="post" id="google_form">
     <input type="text" name="username" class="required"></p>
     <input type="text" name="email" class="required email"></p>
     <input type="text" name="phone" class="required number"></p>
     <input type="text" name="address" class="required"></p>
     <div class="g-recaptcha" data-sitekey="Enter here your key"></div>
     <input type="hidden" title="Please verify this" class="required" name="keycode" id="keycode">


$('#google_form').validate - Validate the form element. after getting server response #keycode value will get captcha hash key value.
<script type="text/javascript">
(function($,W,D) {
    var JQUERY4U = {};
    setupFormValidation: function() {
        ignore: ":hidden:not(#keycode)",
        rules: {       
        "hiddencode": {
        required: function() {
        if(grecaptcha.getResponse() == '') {
            return true;
        } else { return false; }
        } } }
    } }
    $(D).ready(function($) {
})(jQuery, window, document);

Thank you for visiting, Keep in touch with us for more tutorial.

"Excellence is a continuous process and not an accident. "
                                         - A. P. J. Abdul Kalam

Related Topics

  • Analyze and optimize your website with google PageSpeed tools
  • Find latitude and longitude with Google Maps
  • Generate RSS Feed for website using php and json script
  • Ajax add,view and delete using mysqli
  • Active and inactive users concept using php and Ajax
  • How to Make a Simple Search Engine using PHP and MySQLi
  • PDO basic insert,view,update,delete with php function
  • Send email with html template using php
  • Login with facebook using codeigniter


  1. Shit guide! Spent 30 mins trying to figure this out, no luck! Can umaybe write in more detail? not everyone here is a a genius, you know

    1. Hi tony, share your issue's we will guide you.