jquery - Google ReCAPTCHA how to make required? -


does know how make "google recaptcha (v2)" "required" in form?

i mean no form submission until recaptcha filled-in?

i use parsleyjs in form, didnt find way make work divs...

you have use recaptcha verify response call back. this: <script src='https://www.google.com/recaptcha/api.js?onload=recaptchacallback&render=explicit'></script>

var rc2key = 'sitekey',     dosubmit = false;  function recaptchaverify(response) {     if (response === document.queryselector('.g-recaptcha-response').value) {         dosubmit = true;     } }  function recaptchaexpired () {     /* when expires */ }  function recaptchacallback () {     /* must in global scope google access */     grecaptcha.render('id', {         'sitekey': rc2key,         'callback': recaptchaverify,         'expired-callback': recaptchaexpired     }); }  document.forms['form-name'].addeventlistener('submit',function(e){     if (dosubmit) {         /* submit form or else */     } }) 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -