[UPDATE]: it seems that the problemis solved since version 3.1.5 (but I’m not certain if this is version 3.1.5 or since 3.1.6. Anyway, you don’t need to read this post if you are using one of those versions or above.
Motivation: I’m using the WP-reCAPTCHA plugin and there is a javascript error in every page where I didn’t include any post comment box.
Solution: Found here. But I’m copying the solution here anyway:
“In the recaptcha.php page, there’s a function called “save_comment_script”. In the middle of it is a block of code that currently looks like this”
<script type="text/javascript">
var sub = document.getElementById('submit');
document.getElementById('recaptcha-submit-btn-area').appendChild (sub);
document.getElementById('submit').tabIndex = 6;
if ( typeof _recaptcha_wordpress_savedcomment != 'undefined') {
document.getElementById('comment').value = _recaptcha_wordpress_savedcomment;
}
document.getElementById('recaptcha_table').style.direction = 'ltr';
</script>
Change that code to look like this:
<script type="text/javascript">
if(document.getElementById('submit') != null)
{
var sub = document.getElementById('submit');
document.getElementById('recaptcha-submit-btn-area').appendChild (sub);
document.getElementById('submit').tabIndex = 6;
if ( typeof _recaptcha_wordpress_savedcomment != 'undefined') {
document.getElementById('comment').value = _recaptcha_wordpress_savedcomment;
}
document.getElementById('recaptcha_table').style.direction = 'ltr';
}
</script>