Dynamically loading jQuery library from a custom component and ensuring only one instance.

Posted by Paul Lucas on Stack Overflow See other posts from Stack Overflow or by Paul Lucas
Published on 2010-03-26T23:06:08Z Indexed on 2010/03/26 23:13 UTC
Read the original article Hit count: 233

Filed under:
|

Say I have a web component that uses jQuery and I want to distribute it as a packaged component.

I need a way to ensure that the jQuery library is available on or after the page loads, but I also want to check that the containing html page, or another unknown component that may reference jQuery hasn't already added the library to the page.

At the moment the best example I've seen is this

http://www.squidoo.com/load-jQuery-dynamically

It would need a little tweaking, but I was wondering if there were any other best practices.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about web-development