简体   繁体   中英

How will jQuery Document ready behave in a dynamically inserted script?

What if the below script is dynamically inserted into the page after the DOM has been loaded...

$( document ).ready(function() {
  console.log("Will anybody see me?");
});

Will that debug statement still fire?

如果在事件触发添加document.ready处理程序,则将立即调用它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM