Last active
August 29, 2015 13:59
-
-
Save jeremyfelt/10760616 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
$(document).ready(function(){}); | |
}(jQuery)); | |
/* Also worth noting - the above wraps functionality in an anonymous function, allowing you | |
to pass the jQuery object in to use as $. The use of .ready() means it will wait until the | |
entire DOM is loaded and the onReady event fires in the browser. This can sometimes happen | |
a couple seconds after the page has loaded into view. | |
If the script is loaded in the footer of the page, after the DOM is loaded, but not necessarily | |
before onReady fires, you may be able to do everything you need without .ready(), as below */ | |
(function($)){ | |
$('#my-selector').toggle(); // As long as #my-selector is in the DOM already | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You rock. And seem to write documentation effortlessly. Thanks.