UPDATE
I got rid of the errors but the JS still dosen't work.
In the MasterPage head section I have this:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="/js/script.js"></script>
<script src="/js/jquery.sticky.js"></script>
<script>
$(document).ready(function(){
$("#container_menu").sticky({ topSpacing: 0 });
});
</script>
When inspecting the page in the browser I get these warnings and errors:
jquery.min.js:2 jQuery.Deferred exception: Cannot read property 'left' of undefined TypeError: Cannot read property 'left' of undefined at HTMLDocument. (http://localhost:64093/js/script.js:2:31) at l (http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:29375) at c (http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:29677) undefined w.Deferred.exceptionHook @ jquery.min.js:2 jquery.min.js:2 jQuery.Deferred exception: $(...).sticky is not a function TypeError: $(...).sticky is not a function at HTMLDocument. (http://localhost:64093/:17:30) at l (http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:29375) at c (http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:29677) undefined w.Deferred.exceptionHook @ jquery.min.js:2 jquery.min.js:2 Uncaught TypeError: Cannot read property 'left' of undefined at HTMLDocument. (script.js:2) at l (jquery.min.js:2) at c (jquery.min.js:2) jquery.min.js:2 Uncaught TypeError: $(...).sticky is not a function at HTMLDocument. ((index):17) at l (jquery.min.js:2)
ORIGINAL POST
*I'm trying to link a js file from /js/file.js in the head section of a master page. I tried everything I found on the internet with no luck. Not sure what I'm doing wrong.
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"/>
<script type="text/javascript" src="~/js/jquery.sticky.js" />
The error I got is having something to do with the JS code in my opinon. Here's what I got:
BC30035: Syntax error.
Line 1: (function (factory) {
Line 2: if (typeof define === 'function' && define.amd) {
Line 3: // AMD. Register as an anonymous module.
runat="server"
in there. – Andrew Morton