I have an ASP.NET web-app that consists of a master page and several .aspx pages that use that master page.
If I include the jQuery library in the master page at the bottom right before </body> (and after the content placeholder), then in my .aspx pages I am unable to use jQuery because it is included "below" all JS code defined in the pages.
< ASP.NET head placeholder >
< ASP.NET body placeholder >
Regular .aspx page that uses the master page:
< head placeholder > ... </head placeholder>
... code for that particular page ...
... JS code for that particular page ...
</ body placeholder >
The only solution for this problem (that I can think of), is to include the jQuery library in the HEAD of the master page...
At first I was placing the document.ready() code for each .aspx page at the bottom of the page =
However, I thought maybe it's better to place all JS code into one or more external files, so that JS is independent of HTML. So I can:
a) define one JS file for each .aspx page (which seems kind of stupid)
b) put all the code into one file - but then all code runs for every .aspx page that is executed. So if I have, for example, Map.aspx for wich the document.ready() function manipulates a map, and Calendar.aspx for which the document.ready() function manipulates a calendar, if I place all this code into one external document.ready() function, then all this code will run for both the Map.aspx and Calendar.aspx pages.
How do I solve this issue?