Pankaj
Pankaj

Reputation: 4503

Jquery function difference

What is the difference between

$(document).ready(function() {
    //some code here
});

and

$(function() {
    //some code here
});

I feel that they use for the same purpose.

Upvotes: 0

Views: 61

Answers (2)

o.k.w
o.k.w

Reputation: 25820

It's a shortcut/alias to $(document).ready().

Here's something you might want to read:
Introducing $(document).ready()

Upvotes: 1

Rob Fonseca-Ensor
Rob Fonseca-Ensor

Reputation: 15621

They are the same thing: http://docs.jquery.com/Core/jQuery#callback

A shorthand for $(document).ready().

Upvotes: 6

Related Questions