Alternative for "$(document).ready" function

user1662341 picture user1662341 · Sep 11, 2012 · Viewed 53.7k times · Source

I am using fancybox in an aspx page. The document ready function does not work in this page for a lightbox. Someone told me to write a new javascript code for loading the lightbox in that page.

Answer

user338195 picture user338195 · Sep 11, 2012
  • Include jQuery.
  • Check network tab that you are not getting 404.
  • Check console that you are not getting "$ is unknown".

Do stuff when DOM is ready.

$(function(){
   // DOM Ready - do your stuff 
});