I think keeping the source in a variable is the key here, try this:

$('li.clickable').hover(function() {
        var newsrc = $(this).find('img').attr('src').replace
("_off","_over");
        $(this).find('img').attr({src: newsrc});
}, function() {
        var oldsrc = $(this).find('img').attr('src').replace
("_over","_off");
        $(this).find('img').attr({src: oldsrc});
});

On Aug 26, 3:44 pm, wheatstraw <psurr...@gmail.com> wrote:
> OK! we're close...
>
> If I attach this to a variable and echo it out, it give's me the
> correct string. The _off is replaced with _over and the other way
> around. As I have it below, on hover, the image will not change, no
> errors (firebug), just doesn't do anything.
>
> $('li.clickable').hover(function() {
>         $(this).find('img').attr('src').replace("_off","_over");}, function() 
> {
>
>         $(this).find('img').attr('src').replace("_over","_off");
>
> });

Reply via email to