DOMNodeInserted在IE中 [英] DOMNodeInserted in the IE
本文介绍了DOMNodeInserted在IE中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么这段代码在IE中不起作用?请帮助解决它:
Why doesn't this code work in IE? Please help fix it:
jQuery('body').live('DOMNodeInserted',function(e){
var parent = jQuery(e.target).parent();
parent.find("a").css('color','#AA62C6');
parent.find('a').removeAttr('onmousedown');
});
推荐答案
IE不支持此事件。这被添加到IE9,但是似乎在实现中是错误的。
This event is not supported in IE. This is added to IE9 but seems to be buggy in the implementation.
一个解决方案将是处理dom的dom操作(改变dom的方法)
A solution will be to handle the dom manipulation at the base(The method which is changing the dom) level.
function update(){
//do some dom manipulation
$(window).trigger('customupdatedom', parent);
}
$(window).on('customupdatedom', function(e, parent){
//handle dom change
})
您还可以阅读以下内容
DOMNodeInserted在IE中等效?
DOMNodeInserted事件
You can also read the following
DOMNodeInserted equivalent in IE?
DOMNodeInserted event
这篇关于DOMNodeInserted在IE中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文