I have a two images and their rollover images. Using jQuery, I want to show/hide the rollover image when the onmousemove/onmouseout event happen. All my image names follow the same pattern, like this:
Original Image: /CompleteEducation/images/icons/toggleIcon.png
Rollover Image: /CompleteEducation/images/icons/toggleIconDisabled.png
I have used following code but this code overwrite the name:
$(function() {
$("img")
.mouseover(function() {
var src = $(this).attr("src").match(/[^\.]+/) + "toggleIconDisabled.png";
$(this).attr("src", src);
})
});
How can I do it using jQuery?