$(document)
does not guarantee the fact that it is loaded. to do this, you’ll need to either:
- Bind to DOM the old-school way
- Wrap a closure
- Make sure the script is loaded after jQuery (i.e. its script tag is after)
solved Missing step in jQuery and getting “ReferenceError: $ is not defined”