gpt4 book ai didi

jquery - 使 onpropertychange 和 domattrmodified 工作以检测元素何时更改

转载 作者:行者123 更新时间:2023-12-03 22:33:56 24 4
gpt4 key购买 nike

应该会触发一些东西,不是吗?我在 IE8 中不受支持,在 Fx 3.6.10 中没有任何反应

<html>
<head>
<script src="http://code.jquery.com/jquery-1.4.2.js"></script>
<script>


// modified from http://pragmatec.blogspot.com/2009/06/google-toolbar-style-and-tooltip.html
jQuery(function($){
$.fn.dommodhandler = function(options){
function setListeners(){
if (typeof (this.onpropertychange) == "object"){
$('#innerDiv').bind('propertychange',function(e){
$('#msgDiv').html(this.id+' changed</br/>');
});
}
else if ($.browser.mozilla){
$('#msgDiv').html("bind");
$('#innerDiv').bind('DOMAttrModified',function(e){
$('#msgDiv').html(this.id+' changed</br/>');
});
}
else {
$('#msgDiv').html('not supported in this browser');
return false;
}
}
return setListeners();
}
}
);
$(document).ready(function(){
$.fn.dommodhandler ();
});

</script>
</head>
<body>
<div id="wrapper">
<a href="#" onClick="document.getElementById('innerDiv').height='300px';document.getElementById('innerDiv').innerHTML=new Date(); return false">Click</a>
<div id="outerDiv">
<div id="innerDiv">Hello</div>
</div>
<div id="msgDiv"></div>
</div>

</body>
</html>
<小时/>

更新:仍然不高兴...任何人都有任何建议来检测某些内容(ajax)何时由于较大或较小的内容而改变 div 的实际高度

最佳答案

如果您实际更改属性,则会触发事件 (FF 3.6.10): http://jsfiddle.net/Nw4rA/

关于jquery - 使 onpropertychange 和 domattrmodified 工作以检测元素何时更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3863181/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com