I want to use jQuery in an add on JS library that can be added to random websites. These websites may or may not use jQuery already.
I have 3 questions around this actually:
-
I will probably load jQuery dynamically from my own js script (not from a script tag in the document head). Will jquery work this way? how can I make sure it will run in time without having the standard $(document).ready(function(){} in the main document?
-
What should I do to avoid conflicts with existing jQuery (if any) in the web site code.
-
Is there a recommended way to add a widget that includes jQuery to random websites while providing minimal code and simplest integration.
This is pretty loose and incomplete — and really is meant to be a starting point:
then wait via a brief setTimeout() before running a ready() function