1

In Jquery, I understand that

$() 

is there to select an element and when you do something like

$(".foo").click(function(){})

will execute function when foo class is clicked..

but when you do,

$(function(){})

does this mean you are selecting a function? it doesn't seem right to me..

PSL
  • 123,204
  • 21
  • 253
  • 243
lukieleetronic
  • 623
  • 7
  • 10
  • 23

2 Answers2

1

it's just a shortcut for

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

which will be called when the DOM ready event fires

See the documentation for .ready

Austin Greco
  • 32,997
  • 6
  • 55
  • 59
0
$(function(){})

This will be your function that need to be called.

Waqar
  • 826
  • 5
  • 16