First of all, I found this approach here: How do I show multiple recaptchas on a single page?
I tried to use the same method like mentioned here, but that didn't do the trick. In my case, I'm using a typo3-instance, which has to have multiple (2) recaptchas on the same page.
Like mentioned in the answer above, I have a link like this in my <head>
<script src="//www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit" async defer></script>
Then comes the tricky part and I guess, this is where I am stuck:
I tried using the advised JS-snippet, but that didn't do anything. I put the JS-code in a js-file, as well as in my template, to see if the location causes troubles. However, nothing worked.
This is the JS-code i'm using (now taken from the template-file)
<script type="text/javascript">
var CaptchaCallback = function () {
console.log("arrived");
$('.g-recaptcha').each(function (index, el) {
grecaptcha.render(el, {'sitekey': 'my-key'});
});
};
And this is how I try to disply my recaptchas:
<div class="g-recaptcha" data-sitekey="{settings.recaptcha.sitekey}" id="recaptcha_{field.uid}"></div>
which ends up beeing something like this:
<div class="g-recaptcha" data-sitekey="abc-" id="recaptcha_21"></div>
No errors in my js-console as well...
Any ideas?