tcetin
tcetin

Reputation: 11

Uncaught TypeError: Cannot set property 'innerHTML' of null in recaptcha_ajax.js

Im using google recapthca in my site .My site link is http://yundantik.com/tr/ileti%C5%9Fim.html

When I click map image in right in website opening up iframe and close .After getting 'Uncaught TypeError: Cannot set property 'innerHTML' of null' this error.

You can check in site this error in console.

How can I fix this error?

Thanks

Upvotes: 1

Views: 1696

Answers (2)

Simon James Odell
Simon James Odell

Reputation: 11

If you look at the DOM, you'll probably see a bunch of iframes that are being added when you submit the form. I found that adding

$("iframe").remove();

after the form submit code made my captchas show every time.

Upvotes: 1

Fred K
Fred K

Reputation: 13910

It's all about the id of the div where you want to create the reCaptcha. Check if the id is correct. And before create the reCpatcha, check if that id really exists:

if($("#captcha").length) {
  Recaptcha.create("here_is_your_key", "captcha", {
    theme: "clean"
  });
}

Upvotes: 0

Related Questions