Your code is a classic closure. It does not wait for the DOM to be ready. It just makes local variables, and aliases $ for jQuery.
$(function(){...}) Is the simple ready callback,
jQuery(function( $ ){...}) is a combination of the two. ready and $ is aliased for jQuery.
JΛ̊KE