17
Jul/091
Jul/091
$(document).ready() Shortcut
When writing jquery you almost always put your code within a ready block:
$(document).ready(function(){
// Code...
});
// Code...
});
And I always forget the exact syntax. I just found that jQuery has a shortcut:
$(function(){
// Code...
});
// Code...
});
Much better!
Comments (1)
Trackbacks (0) ( subscribe to comments on this post )
Leave a comment
No trackbacks yet.

3:31 pm on June 7th, 2010
I heard about this in a jQuery presentation, but the presenter never posted the code. This was just what I was looking for – thanks for the great tip!!!