javascript 脚本错误:在关闭子元素之前无法修改父容器元素
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13731921/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Script Error: Unable to modify the parent container element before the child element is closed
提问by user1879703
Script Error: Unable to modify the parent container element before the child element is closed. What should I do? I click Yes, and my web page isn't displayed.
脚本错误:在关闭子元素之前无法修改父容器元素。我该怎么办?我单击“是”,但不显示我的网页。
At the beginning of my Product page code, I have: http://pastebin.com/iiUfMq1v
在我的产品页面代码的开头,我有:http: //pastebin.com/iiUfMq1v
Everything works fine in every browser except IE8, that is the only browser that is throwing any sort of error.
在除 IE8 之外的所有浏览器中一切正常,IE8 是唯一抛出任何类型错误的浏览器。
Any ideas?
有任何想法吗?
回答by Dilip Rajkumar
Please check these links
请检查这些链接
Basically it will happen when you try to update a element by javascript which is the parent of current element or the element does not render at all. I faced this issue and fixed by running the script after the page loads. i.e inside $(document).ready()
基本上,当您尝试通过作为当前元素的父级的 javascript 更新元素或该元素根本不呈现时,就会发生这种情况。我遇到了这个问题,并通过在页面加载后运行脚本来解决。即里面$(document).ready()
hope this helps someone..
希望这有助于某人..
回答by John Lindal
IE has historically not allowed the DOM to be modified until after the domReady event.
IE 一直不允许修改 DOM,直到 domReady 事件之后。