Revision: 69870
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 27, 2015 01:46 by SmellWing
Initial Code
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
// IIFE - Immediately Invoked Function Expression
(function(yourcode) {
// The global jQuery object is passed as a parameter
yourcode(window.jQuery, window, document);
}(function($, window, document) {
// The $ is now locally scoped
// Listen for the jQuery ready event on the document
$(function() {
console.log('The DOM is ready');
// The DOM is ready!
});
console.log('The DOM may not be ready');
// The rest of code goes here!
}));
</script>
Initial URL
http://gregfranko.com/jquery-best-practices/#/8
Initial Description
JQUERY READY EVENT BEST PRACTICE
Initial Title
Best Jquery Declaration
Initial Tags
jquery
Initial Language
jQuery