"ReCAPTCHA has already been rendered in this element"

4,299 views
Skip to first unread message

Miguel Diganchi

unread,
May 12, 2016, 10:48:01 PM5/12/16
to reCAPTCHA
Hello people!

I am using the google recaptcha 2. When I render the recaptcha (the first time), after the following  function, 

function renderRecaptcha(container) {


 
// get container
 
var recaptcha_container = container ? container : $('.rc.m');
 
if ($(recaptcha_container).length < 0) {
    console
.log('rendering error');
   
return false;
 
}


 
// load recaptcha element taking only first element
 recaptcha_container
= $(recaptcha_container)[0];


 
// get recaptcha id
 
var recaptcha_container_id = $(recaptcha_container).attr('id')
 
if (!recaptcha_container_id) {
   console
.log('rendering error');
   
return false;
 
}


 
// clear recaptcha container
 $
(recaptcha_container).html('');


 
// render
 
var widget_id = grecaptcha.render(recaptcha_container_id, {
     
'sitekey' : '[sitekey]',
   
});


 grecaptcha
.reset();

}



...the recaptcha is rendering perfectly. But, in the second (and the following) render call to the same element, I am getting this error: 

"ReCAPTCHA has already been rendered in this element" in the rendering context, 

Can you help me with this issue?

Regards!
Reply all
Reply to author
Forward
0 new messages