我的問題是,我有一個按鈕,當用戶將鼠標懸停在它上面,它應該改變文本..當他們徘徊它應該回到以前是如何。jQuery懸停不停止
這裏是我的jQuery
$(document).ready(function() {
$("#followingbutton").hover (
function() {
$(this).replaceWith("<input type='submit' value='Unfollow' id='followingbutton' class='button red' />");
},
function() {
$(this).replaceWith("<input type='submit' value='Following' id='followingbutton' class='button green' />");
});
});
它應該像twitter的後續/取消關注按鈕。任何人都可以爲我揭開一些光明嗎?
編輯:一切工作正常,但它不會「unhover」
爲什麼不只是c增加價值和班級? – Rodolphe