What is oncontentready event?
What is the oncontentready event? When is it raised? How can i use this event? I want to convert an htc file to jquery. Please help 开发者_JAVA技巧with explaining this event.
use $(document).ready(fn)
in jquery or $(element).load(fn)
(supports few elements)
It is a custom function/code call when all page elements are loaded (including images and css).
$(document).ready(function(){
// your code will be executed after all items on page will be loaded
});
From the jQuery API docs:
Most browsers provide similar functionality in the form of a DOMContentLoaded event.
Looking at DOMContentLoaded on MDN it states (emphasis mine):
The DOMContentLoaded event is fired when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.
This event does not wait for external assets (like images, scripts, CSS, etc) to load and is fired as soon as the DOM has been parsed by the browser.
精彩评论