My favorite way to do this is to take advantage of the fact that the the
script tag is the last one in the document at the time that it's executed.
This works with inline scripts as well as .js files.

Try pasting this code into the body of a test document:

    Insert text here: {
        <script type="text/javascript">
            (function() {
                
                var script = $('script:last');
                
                $(function() {
                    $(script).after( 'Hello World' );
                });
                
            })();
        </script>
    }

But I'm curious: Why can't you use document.write?

-Mike

> From: Sagari
>
> The task: to add content (HTML) exactly at the place where
> <script> was placed, i.e. how do I get the parent of a
>
> <scrirpt type="text/javascript" src="scriptsource.js"></script>
>
> -like tag?
>
> I need to use DOM scripting, not document.write().

Reply via email to