$("body *").live('mouseover', function() {
var currentId = $(this).attr('id');
var html = "<div id='perfect4' style='font-size:10px;'><div id='pos1'><br>ID: " +currentId+
" <br>Klasse: " +currentClass+ " </div><div id='pos' style='width:300px'></div></div>";
$("#perfect4").html(html).replacewith(html);
});
,在FF,因爲有一個錯誤的原理(replacewith
) 我知道,replaceWith
將是正確 ,但不這樣做,它不會工作問題與jQuery內容加載到DIV
是不工作:
$("#perfect4").html(html)
爲什麼?
,你必須定義currentClass? – Vivek 2011-05-12 09:44:27
[jQuery與.live,.mouseover和.replaceWith/.html問題]的可能重複(http://stackoverflow.com/questions/5979635/jquery-problem-with-live-mouseover-and-replacewith-html) – 2011-05-12 14:45:07