为什么这不起作用?我不能使用CSS,因为如果子元素悬停在自身上,图像将会被更改(除非我可以吗?)无论如何,这里是代码:
jQuery的:
$("#prop-find-similar").hover(function(){
$("#search-icon").src = "images/search-icon2.png";
}, function(){
$("#search-icon").src = "images/search-icon.png";
});
HTML:
<span id="prop-find-similar"><img id="search-icon" src="images/search-icon.png">Find Similar</span>
答案 0 :(得分:0)
$("#prop-find-similar").hover(function(){
$("#search-icon").attr("src", "images/search-icon2.png");
}, function(){
$("#search-icon").attr("src", "images/search-icon.png");
});