I created an element in an outer javascript file:
var element = document.createElement('div');
Now I need to append the lement to the body and still keep the reference to it (element variable).
But I need to append it right after the script tag – like document.write() would do it.
I can’t use classes and id’s for the script and the element itself – I’m not on my site and there could be more than one of those scripts.
How to solve such task?
CONTEXT: I’m want to build some widgets which could be used on others sites.
How about this:
EDIT: I edited my code. Try it out!