I've got some images that I want to change to another image when I hover over a div. Image 1: "geluid1", image 2: "geluid2".
$(".block").mouseover(function(){
$("img",this).attr("src").replace("1","2");
});
But for some reason this doesn't seem to work properly. Can someone help me find the problem?
Your code just get the
src
of the image and replaced the content. However, it did not updated thesrc
attribute of theimg
.You didn't set the
src
attribute value of theimg
. Use the following code to set thesrc
value to the replaced one.CODE