-
-
Save tommcfarlin/83f079ed5d3a1bdd06cd74382a5e2a51 to your computer and use it in GitHub Desktop.
[WordPress] IIFE For JavaScript in WordPress
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( $ ) { | |
'use strict'; | |
$(function() { | |
// Code to fire when the DOM is ready. | |
}); | |
})( jQuery ); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code. |
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( $ ) { | |
'use strict'; | |
/** | |
* This function can be referenced inside of this particular file but no where else. | |
*/ | |
var example_function = function() { | |
// Do some neat work like write random data to the console. | |
}; | |
$(function() { | |
// Code to fire when the DOM is ready. For example... | |
example_function(); | |
}); | |
})( jQuery ); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment