Here you’ll find some useful jQuery snippets for document loaded.
jQuery Document Ready
Javascript Class
Replace $CLASS_NAME$
Use strict directive
1 2 3 4 5 |
(function(){ "use strict"; // Define your library strictly... })(); |
You can find out more stric directive in the John Resig – ECMAScript 5 Strict Mode, JSON, and More page.
Tips
The following snippets issue the same effect
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
+function() { console.log( 'Hello World'); }(); // or (function() { console.log( 'Hello World'); })(); // or (function() { console.log( 'Hello World'); }()); // or +function( $ ) { console.log( 'Hello World'); }( window.jQuery ); // or (function( d, $ ) { console.log( 'Hello World'); }( document, jQuery )); |
As usual, please don’t hesitate to leave any questions or comments in the feed below, and I’ll aim to respond to each of them.