Jquery document.ready function is bit different than in Drupal 6.
In Drupal 6, we simple add the document.ready function and it works like:
$(document).ready(function() {
});
But in Drupal 7, there are some change in the API, to make document.ready working in Drupal 7 and function before the document.ready as:
(function ($) {
$(document).ready(function() {
});
})(jQuery);