0
我有一個圖像的值,我希望能夠懸停在圖像上並將其更改爲文本(以顯示圖像的含義,因爲圖像相當小)懸停時更換標籤 - 用文字替換圖像
我試過使用replaceWith
,但是當你停止盤旋時不起作用。
$(document).ready(function(){
$("#apples").hover(function(){
$(this).replaceWith("<span id=\"apples\">apples: 10</span>");
}, function(){
$(this).replaceWith("<span id=\"apples\"><img src=\"images/apples.png\" alt=\"apples\"/> 10</span>");
});
});
希望我解釋正確。我只是想用蘋果的文字轉換出蘋果的形象,當用戶將鼠標懸停在上面時。