开发者

Multiple References to the JQuery Library in a page

开发者 https://www.devze.com 2023-01-15 05:39 出处:网络
I have an ASP.NET application using a master page.I am adding a reference to the JQuery library in the master page howe开发者_StackOverflow社区ver there are some content pages and user controls that r

I have an ASP.NET application using a master page. I am adding a reference to the JQuery library in the master page howe开发者_StackOverflow社区ver there are some content pages and user controls that reference the JQuery library directly. Will I need to remove each reference from those pages or can I leave them in place even though I am adding a reference into the master page of the application?


If you're loading jQuery with the Script Manager, it should load only once.

If you still want intellisense, you can use the following trick:

<% if (false) { %>
  <script src="....... script tag here
<% } %>


You should remove them, including the library twice has many side-effects, wiping out any plugins defined for example. It'll load fine, but you'll start getting .pluginMethod is not defined, etc.

To avoid the headaches, only include them once, or register the script with the same key, and let ASP.Net do the include, and with the same key, it'll do so only once.


You will need to remove them I'm afraid. Came across this issue myself and the javascript will break.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号