简体   繁体   中英

how do i avoid including jquery twice?

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?

检查jQuery是否存在,并针对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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM