我有以下代碼:如何正確捕捉mouseout事件?
<div class='no_translate'>Not translated</div>
,並按照鼠標懸停/鼠標移開事件代碼:
$('.no_translate').mouseover(function() {
$(this).empty();
var field="<form method='POST' action=''><input name='a' type='textarea'/></form>";
$(this).html(field);
});
$('.no_translate').mouseout(function() {
$(this).empty();
$(this).html('Not translated');
});
我想簡單的文字轉換成輸入字段和背部。但是有一個小問題:當我將光標移動到一個新字段上時(不要從它出來),那麼這個字段會轉換成簡單的文本並返回很多次,但是我不會從中解脫出來,而且我也不明白這是怎麼回事。請告訴我。先謝謝你。
你需要使用懸停事件。 – Hardik 2012-07-11 07:20:41