-2

Hi I'm new to jQuery and I would like to know the difference between:

$(function() { });

and

$(document).ready(function() { });

Thanks!!

pmandell
  • 4,278
  • 16
  • 21
joseagaleanoc
  • 527
  • 1
  • 7
  • 19

2 Answers2

2

The first notation :

$(function(){ ... });

is short-hand for the second-choice :

$(document).ready(function(){ ... });

They will both do the exact same thing, however the first will just require slightly less code.

Rion Williams
  • 72,294
  • 36
  • 192
  • 318
0

no difference - just different notation

Aris
  • 4,219
  • 1
  • 35
  • 36