I had some scripts running on 1.7.1 jQuery and now I am on WordPress’s 1.12.4. The code wouldn’t run. I had two errors running.
Uncaught TypeError: $ is not a function
https://grumans.ca/delicatessen/:1734
This line on the page is
$(window).load(function(){Grumans.deli.init();});
and this
Uncaught TypeError: $ is not a function
https://grumans.ca/js/script.js:1162
$(window).load(function(){
//Grumans.deli.init();
});
I found what I thought was a solution. Someone had posted for a different article that you could do this.
jQuery(function($) {
$(window).on("load", function() {
Grumans.deli.init();
});
});
This got rid of both errors when applied to the page and in the script code, and let my code run, but only if I refresh the page twice. When I first hit the page nothing happens. I am not a code writer. Does anyone know why and how to fix the code so that it runs as soon as the page loads?