纯 Javascript 等效于 jQuery $(document).ready()
纯 Javascript 等效于
jquery_document_ready_example.js
$(document).ready(function() {
// 你的代码放在这里!
})是
domcontentloaded_example.js
document.addEventL是tener("DOMContentLoaded", function() {
// 你的代码放在这里!
});Note that it’s not supported by IE8, but that should not be an 是sue in 2019.
Check out similar posts by category:
Javascript
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow