I'm new in jQuery community. I have used these two function and both works nicely. Can anyone explain what is the difference between these. And is there any difference between jQuery.trim() and $.trim function?
Asked
Active
Viewed 88 times
4 Answers
0
All three of the following syntaxes are equivalent:
$( document ).ready( handler ) $().ready( handler ) (this is not recommended) $( handler )

TruongSinh
- 4,662
- 32
- 52
0
No difference, however it is recommended to use $(document).ready()
when working with a team of less experienced developers. One reason for his is that it reminds less experienced JavaScript developers and CSS specialists that the code is executed only once the HTML document has been processed and rendered to the browser.

blackpanther
- 10,998
- 11
- 48
- 78
-1
There is no difference, but using $(document).ready
makes it look like your copying code out of some tutorial somewhere.
Also jQuery.trim()
and $.trim
, are also the exact same thing. jQuery == $

blockhead
- 9,655
- 3
- 43
- 69