Using Self Calling Anonymous Functions and $(document).ready

This is a common pattern with jQuery extensions to ensure that they are always added to the jQuery object, but can be written using $ to keep the code tidy:

(function($){
   $(function(){
      // your code here
   });
})(jQuery);

The $ would actually reference the jQuery library inside while still referring to Prototype on the outside! This can help tidy up your code

Source: javascript – Using Self Calling Anonymous Functions and $(document).ready – Stack Overflow

Leave a Reply

Your email address will not be published. Required fields are marked *