using jquery, how do you change the image on hover inside of a div

Posted by oo on Stack Overflow See other posts from Stack Overflow or by oo
Published on 2010-04-24T11:48:34Z Indexed on 2010/04/24 11:53 UTC
Read the original article Hit count: 204

Filed under:
|

i have the following jquery code to replace an image when you hover over with the mouse but it doesn't seem to be working. Can anyone find anything wrong with this code below.

$(function() {
$("div.delete img")
    .mouseover(function() {
        $(this).attr("src", "../../images/comment-hover-del.png");
    })
    .mouseout(function() {
        $(this).attr("src", "../../images/comment-del.png");
});
 });

and this is my html:

<div class="delete" id="26"><img src="../../images/comment-del.png" border="0"></div>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about images