"JavaScript is a language whereas jQuery is a library written using JavaScript".
jQuery
is a fast, lightweight JavaScript library that is CSS3 compliant and
supports many browsers. The jQuery framework is extensible and very
nicely handles DOM manipulations, CSS, AJAX, Events and Animations.
The onLoad function for the window object executes after the entire page is fully loaded.Untill DOM tree is completely created and all images/other associated resources (like audio files,video files etc) are fully loaded,this onLoad function is never executed and hence the script execution needs to wait till the page is loaded.
But the document.ready() method of JQuery indicates that the DOM of the page is ready and we can start manipulating the DOM elements even though other parts of the page content(e.g. images/other external resources) are not fully loaded.As soon as the DOM is loaded, everything inside the (document).ready() should be load even before the page contents are loaded.
It is because of this reason that JQuery code runs faster
No comments:
Post a Comment