Question

What is the correct way to include the JQuery libraries via a master page? It appears there is a set for development and a set for production. I tried an "#if DEBUG" in my master page and it tripped errors left and right. I was also using <% %> style code and found out that I am not allowed to do that either. And my google-fu has not been good lately.

Was it helpful?

Solution

Scott Gu's Blog had a post on this a while back.

But essentially all you need on the master page is a link (as Alex posted earlier)

You can use code blocks to include a Intellisense version by doing :

<% if ( false ){ %>
     <script type="text/javascript" src="jquery-vsdoc.js"></script>
<% } %>

on any of the individual pages which you require intellisense on.

OTHER TIPS

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>

Will include jQuery off Google's servers. The production one is the minified version (smaller file size).

Including this one will benefit you- There is a good chance (with more developers adopting this technique) that the person will have already visited a site with this link, and therefore having jQuery cached).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top