Home > Web Front-end > JS Tutorial > Detailed explanation of the difference between JQuery's ready function and JS's onload_jquery

Detailed explanation of the difference between JQuery's ready function and JS's onload_jquery

WBOY
Release: 2016-05-16 17:13:27
Original
850 people have browsed it

The difference between JQuery's ready function and JS's onload:
1. Execution time
window.onload must wait until all elements in the page, including images, are loaded before it can be executed.
$(document).ready() is executed after the DOM structure is drawn, without waiting until it is loaded.


2. Different writing numbers
You cannot write multiple window.onloads at the same time. If there are multiple window.onload methods, only one will be executed.
$(document).ready() can be written at the same time Write multiple and all can be executed


3. Simplified writing
There is no simplified writing for window.onload
$(document).ready(function(){}) can be abbreviated as $(function(){});

" -//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

                                                                                                                                                           worse not have been the same? ;                                      
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template