This question has been answered by BobRay. See the first response.
$(document).ready(function(){ // Your code here });