$(document).onload()
it's internally implemented by window.onload event
then what about
$(document).ready()
what's the native javascript to implement it?
jQuery $(document). ready() Equivalent in JavaScript This event fires when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.
ready() function will load as soon as the DOM is loaded and before the page contents are loaded. You should wrap all your javascript code with this function to ensure that the code only runs when the page is fully rendered.
The document. ready event occurs when the HTML document has been loaded, and the window. onload event occurs always later, when all content (images, etc) has been loaded. You can use the document.
For Mozilla, Opera and webkit, jQuery binds the DOMContentLoaded event, for IE jQuery uses the onreadystatechange event.
Look the internal bindReady function on the jQuery source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With