Phone: +65-8585-1750

Address: 30 Holland Close, Singapore

jQuery - Safe 'onReady' code

Fri, Jan 7, 2011 mdda OSS Blog Comments

jQuery - Safe ‘onReady’ code

Just a quickie that combines the $(fn) method of calling a function when the DOM is ready, with an anonymous function that ensures that $ refers to jQuery :

    (function($) {
      $(function () {
        // your code to fire when the DOM is ready
      });
    })(jQuery);

blog comments powered by Disqus