Javascript/JQuery suddenly stops working in Chrome and Firefox, but still works in Safari
<p>As the title states, I have a script that has just suddenly stopped working properly.</p>

<p>The script essentially replaces a jpg with an animated gif once hovered over said jpg.</p>

<p>Until today everything was working fine, but now the the animated gif doesn't play anymore for some unknown reason. With Firebug open, I can see that the script is still doing its job (jpg gets swapped for gif).</p>

<p>This problem is not occurring in Safari, but is occurring in Chrome and Firefox.</p>

<p>I'm guessing the problem is more to-do with the browsers and the gif rather than the script?</p>

<p>Here's the script:</p>

<pre><code>    $(".image").hover(function(){
    $(this).attr("src", function(index, attr){
    return attr.replace(".jpg", ".gif");
    });
}, function(){
    $(this).attr("src", function(index, attr){
        return attr.replace(".gif", ".jpg");
    });
});
</code></pre>