If the script is on the page at load time then as far as I understand the browser will execute it. If you try and put some javascript higher on the page before that element is added to the document then there isn't anyway to address that div element as it technically doesn't exist yet. Yet if you put something after or below the element then at that point the browser would have already added the element and executed the script within it.
However, if you are using the .append() or .load() functions then you should be able to check the contents of what you are appending or loading and remove any scripts in it prior to appending or loading it into the target element.
