Loading Scripts Sequentially with Onload Event
When attempting to load scripts in a specific order, it's crucial to ensure that the onload event is triggered as expected. However, using jQuery's append() method to add script elements to the DOM can sometimes prevent the onload event from firing.
Solution:
To resolve this issue, it's necessary to make two adjustments:
el.onload = function() { el.src = script; };
$body.append(el); el.onload = function() { el.src = script; };
Additional Considerations:
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3