Dynamically load Jquery into .js page
- by RussP
Please excuse me if I'm simple here, I want to create a simple widget that people can access from their websites - e.g by copy/past something like
<script language="javascript" src="test2.js"></script>
<div id="test"></div>
anywhere in their web pages. where is dynamically filled via Jquery and the functions in/on test2.js.
I can do it if JQuery is actually "printed" on the page of test2.js, but I cannot get any JQuery functions to work if I try to include/call JQuery dynamically. How do you call JQuery via javascript and then get it to work with the functions on the page?
And/Or is there an easy way to add the <div id="test"></div> dynamically aswell? Sure I can body.append etc. but that only adds at the bottom of the page. Is there a way to .append in the position where the script include
<script language="javascript" src="test2.js"></script>
is actually placed?
Hope I make sence.