Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: ReCAPTCHA placeholder element must be empty

I am using recaptcha with my laravel application.

I just want to check recaptcha's response on form submit using jquery and stop user by alert that pleade validate captcha.

but , I could not stop form submission even if captcha is not filled.

here is my code.

 $('#payuForm').on('submit', function (e) {                      var response = grecaptcha.getResponse();                      if(response.length == 0 ||  response == '' || response ===false ) {                         alert('Please validate captcha.');                         e.preventDefault();                     }                 });    <div class="captcha">  {{ View::make('recaptcha::display') }} </div> 

I am getting this error in browser console , and form gets submit.

Error: ReCAPTCHA placeholder element must be empty 
like image 960
Nirali Joshi Avatar asked May 04 '16 07:05

Nirali Joshi


1 Answers

You are loading the google recaptcha library twice.

https://www.google.com/recaptcha/api.js

like image 158
Syed Waqas Bukhary Avatar answered Sep 23 '22 05:09

Syed Waqas Bukhary