开发者

how do i avoid including jquery twice?

开发者 https://www.devze.com 2022-12-19 10:00 出处:网络
i have a service i\'m building, which will be included as JS on client web pages. optimally, i want to build the service using jquery.

i have a service i'm building, which will be included as JS on client web pages. optimally, i want to build the service using jquery.

the case may arise, where the page already has JQ included.

how do i avoid including JQ twice in the page? how开发者_如何学编程 do i make sure i still have the desired JQ functionality, even if the page has already included an older version of JQ?

is the only solution simply abandoning JQ and going with hand-coded script?


Check for the existence of jQuery and match the version you need against jQuery.fn.jquery.


from the linkedin jquery group:

Ever want to use the latest jQuery, but old code or components leaves you with an older version? Well this standalone version can be included anywhere on the page and will take a custom name space of jQuery14, and will not affect jQuery or $ in any way. Also, easy way to integrate among other frameworks.

http://www.matthewdunham.com/jquery-1.4.2.min.standalone.js

0

精彩评论

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