When working with Dynamics 365 you may encounter a ReferenceError: '$' is undefined at... error message similar to this:

This error message occurs when a custom script depends on jQuery, but jQuery did not load before the script executes. You can find the JavaScript file causing the error using the information in the Script Error combined with the associated log obtained from clicking the Download Log File button.

If the jQuery is on the page but not loading in the correct order then you can resolve the error message with the below script:

if (typeof($) === 'undefined') {
	$ = parent.$;
	jQuery = parent.jQuery;