Thursday, December 22, 2016

Error: ReCAPTCHA placeholder element must be an element or id

Couldn't find an answer to this simple error anywhere.

This error means that the recaptcha api function couldn't find the referenced id:

In my case, I was using this function to render the captcha into a custom div:

grecaptcha.render("phone-recaptcha", {sitekey: "6Lfdkxxxx", theme: "light"});


This is how my div looked:

<div class="phone-recaptcha"></div>

All I had to do to fix this was changing my custom div to the following:

<div id="phone-recaptcha"></div>

That's it! hope you find this helpful.

No comments:

Post a Comment