I\'m trying to change an image in JavaScript+Prototype by changing the \"src\" attribute of the element. It works fine in IE, but not in Firefox. I don\'t get any errors and the
This function works fine in all browsers(chrome,Firefox,IE,Edge,...):
function recaptcha() {
$("#captcha-img").attr('src', "");
setTimeout(function(){
$("#captcha-img").attr('src', "captcha?"+new Date().getTime());
}, 0);
}
The important point is generating new URL which forces FF and IE to re-render the image.