I have jQuery as a script source before my custom site.js
file.
<script src="/Scripts/jquery-3.5.1.js"></script>
<script src="/Scripts/site.js"></script>
In site.js
I have the following:
$(window).on('load', function () {
console.log('test');
});
The following is the output from the console:
VM318 site.js:142 Uncaught ReferenceError: $ is not defined
at VM318 site.js:1:1
(anonymous) @ VM318 site.js:1
site.js:2 test
I am not sure what I am missing here? I have written a function to test jQuery and it works in site.js
:
function testFunc() {
let test = $('#test');
}