If you replace the “$(function(){” section with window.onload you can ensure that all script files have been loaded before attempting to fire your function.
However, be aware that this fires much later that jQuery’s document.ready. jQuery’s method fires when the dom is loaded whereas window.onload waits until the whole document and it’s scripts have been loaded.
More info and example here:
https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onload
0
solved “$ is not defined” jQuery bottom with PHP include