8.23.2012

jQuery Difference FAQs-1

1.Difference between body.onload() function and document.ready() function used in jQuery
S.No body.onload() document.ready()
1
We can have only one onload function
We can have more than one document.ready() function in a page
2
body.onload() function is called when everything gets loaded on the page that includes DOM, images and all associated resources of the page.
document.ready() function is called as soon as DOM is loaded

2.Difference between jquery.size() and jquery.length
S.No
jquery.size()
jquery.length
1
jquery.size() is slower than
jquery.length
jquery.length is faster than
jquery.size()
2
size() is a method
length is a property

Summary:

jquery.size() and jquery.length both returns the number of element found in the
object. jquery.size() is slower than jquery.length as there is always an overhead in
calling a function

No comments:

Post a Comment