我需要通过 $.getScript 动态包含一个脚本。
但是问题是,动态包含的脚本中的 $(document).ready 函数没有被执行。 (他们动态插入不会在 dom 就绪时发生)
有什么方法可以强制它这样做吗?例如,伪造一个 document.ready 事件?
谢谢, 卫斯理
最佳答案
在触发 doc ready 之后,任何 future 的 doc ready 调用都将在解析时执行。
The handler passed to .ready() is guaranteed to be executed after the DOM is ready
关于javascript - 重置 document.ready ($.getScript),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6502943/