If the recaptcha form parts are inserted into the page before the submit button, there is a JS error that "sub" is not defined. This is because of these lines
var sub = document.getElementById('submit');
sub.parentNode.removeChild(sub);
being executed before the element even exists.
The solution would be to use the following, which causes the JS executed when all HTML is loaded:
recaptcha = function()
{
// here comes all the code embedded to the page
};
if (window.attachEvent) { window.attachEvent('onload', recaptcha); }
else if (window.addEventListener) { window.addEventListener('load', recaptcha, false); }
else { document.addEventListener('load', recaptcha, false); }
(The last three lines make sure it runs in all modern browsers.)
If the recaptcha form parts are inserted into the page before the submit button, there is a JS error that "sub" is not defined. This is because of these lines
being executed before the element even exists.
The solution would be to use the following, which causes the JS executed when all HTML is loaded:
(The last three lines make sure it runs in all modern browsers.)