$(Document).Ready() vs window.onload()
$(document).ready() is a jQuery event. This method gets called as soon as the DOM gets ready.DOM means all the html tags i.e. anchor tag, table, div, paragraph etc..).
Main points for $(document).ready():
- It will not wait for the images, frames etc. to be loaded.
- It is used to execute JavaScript when the DOM is completely loaded.
- It is not used if you want to manipulate images. Use window.onload() instead.
The window load event gets fired, when the complete page is fully loaded, including all frames, objects and images. Therefore functions which concern images or other page contents should be placed in the load event.
No comments:
Post a Comment