Each page can have its own element.Just that the scripts once
added in Parent page will be added automatically to the DOM when the
child pages rendered since they are connected.When pages have multiple
parent, script tag has to be added in all their respective Parent pages.
One possible and suggested way could be to have a Parent-Child html page
design(in some technology we also refer them as Layout page), where all
pages have one parent common page.You can than reference your script
only in Parent page and all Child pages will automatically have
reference to it.
There are 2 things which might be causing this:1) Important thing here
is the time at which this dynamic addition of the script is happening.
Please ensure this script gets loaded on the page well before, or, at
the time when DOM gets created. Something like document.ready() in
Jquery, or, something...