JQuery: NOT using document.ready and inserting HTML Tags = is this allowed?

Posted by jens on Stack Overflow See other posts from Stack Overflow or by jens
Published on 2010-03-17T20:31:37Z Indexed on 2010/03/17 20:41 UTC
Read the original article Hit count: 415

Filed under:

Hello,

is this a valid JQuery usage pattern to :

<script type="text/javascript">
        $("body").prepend('<input type="hidden" id="error" value="show">');         
    </script>

That is using Jquery to manipulate / insert HTML Tags when the Document has NOT YET been loaded (by not using document.ready for the inserting into the DOM)?

(Normally I only use document.ready, but in this case I need to insert some Information into the DOM that then is present, when document.ready is called. This is some kind of "happens-before" relations ship I want to achieve so that I am shure when document.ready is called the inserted Form field is available in the document, as I depend on that information.

Thank you very much jens

© Stack Overflow or respective owner

Related posts about jQuery