Prevent Submit until reCaptcha

Disable Submit button until Google reCaptcha is verified, used reCaptcha v2.0
This is part of war against spammers

CodeFunctionName
What is this?

Public

Tested

Original Work
<!-- As expected, put the main js from google recaptcha in head -- >
<!-- We will also put the functions to modify submit control here -- >
<script src='https://www.google.com/recaptcha/api.js' > </script >
<script >
function capenable() {
$(':input[type="submit"]').prop('disabled', false);
}
function capdisable() {
$(':input[type="submit"]').prop('disabled', true);
}
</script >

<!-- Then, before </form >, put below code -- >
<div class="g-recaptcha" data-sitekey="..." data-callback="capenable" data-expired-callback="capdisable" > </div >
<input class="btn btn-primary btn-block" type="submit" disabled="true" id="capsubmit" value="Send" / >
</form >


Views 2,976

Downloads 990

CodeID
DB ID