On the jQuery site, the description for $(callback)
was that it behaves the same as $(document).ready(function)
but then the examples showed some differences between the two syntaxes. So I was wondering, does anyone know exactly what the differences between the two are?
There are no differences, and the docs don't show any difference:
All three of the following syntaxes are equivalent:
- $(document).ready(handler)
- $().ready(handler) (this is not recommended)
- $(handler)
Straight from: http://api.jquery.com/ready/
I think you are confused by the example showing jQuery(function($){ ... });
Which is just a way of calling $(handler)
, with no $
conflict.
IE.
// Here `$` is used by another library
jQuery(function($){
// Here `$` refers to jQuery
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With