Created
March 9, 2018 15:42
-
-
Save kimschles/9d9002aa10bf51bfc22c7f4fa692cc99 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Thank you, Dan Levy | |
| function domReady(f, o, m) { | |
| (o = document), (m = 'addEventListener'); | |
| o[m] ? o[m]('DOMContentLoaded', f) : ((o = window), o.attachEvent('onload', f)); | |
| } | |
| // example usage: | |
| domReady(function() { | |
| const form = document.querySelector('form'); | |
| document.querySelector('form').addEventListener('change', getAdjective); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment