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
srcof the image and replaced the content. However, it did not updated thesrcattribute of theimg.You didn't set the
srcattribute value of theimg. Use the following code to set thesrcvalue to the replaced one.CODE