a developer's notes – a semi-technical web development BLOG

March 27, 2013

$document.ready() Shortcut in jQuery

Filed under: Javascript / JQuery,Uncategorized — Duy Nguyen @ 11:52 am
Tags: , , , ,

You can just use this:

$(function() {
     // do something on document ready
});

It is the same as this:

$(document).ready(function(){
     // do something on document ready
});

But if you’ve placed all your scripts right before the body closing tag, this is the same as $(document).ready.

Advertisements

Blog at WordPress.com.