Reputation: 275
I'm loading reCAPTCHA via JavaScript http://www.google.com/recaptcha/api/js/recaptcha_ajax.js and am using jquery-1.5.2.min.js to communicate with a local PHP script which then validates the input via Google's recaptchalib.php and returns data to the JavaScript in JSON format. It all works, but Google Chrome's Console reports an error:
Uncaught TypeError: Cannot set property 'innerHTML' of null recaptcha_ajax.js:15
Recaptcha._init_builtin_theme recaptcha_ajax.js:15
Recaptcha._finish_widget recaptcha_ajax.js:19
Recaptcha.challenge_callback recaptcha_ajax.js:13
(anonymous function) challenge:12
I would like to resolve that error but I don't know how to go about it.
Upvotes: 5
Views: 11213
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: 2
Reputation: 65126
Perhaps you're passing it a nonexistent element to instantiate itself in. Are you sure you didn't misspell an id
or something like that?
Upvotes: 3