In the examples I gave the new element is "saved" to the variable
inputBox. So to add it to the DOM you will do something like what Erik
wrote, that is:

    inputBox.appendTo('#myForm');

The above appends it (that is, adds it as the last element) to an
element with id="myForm".

There are other options such as "prependTo", "insertBefore" and
"insertAfter". More details on these here:
http://docs.jquery.com/DOM/Manipulation

Karl Rudd

On 8/17/07, Pops <[EMAIL PROTECTED]> wrote:
>
> On Aug 17, 2:10 am, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
> > It's already built in. For your example:
> >
> >   var inputBox = $('<input>').attr("type", "text").attr("id", "someText");
> >
>
> Karl,
>
> Question,  I've still learning jQuery, so please forgive me as I am
> not 100% sure if I will poise the question correctly.
>
> When you do something like above, is the element already in DOM or
> just saved in a variable "inputBox"?  ready to be added (i.e.
> appended) to "DOM" at some later point?
>
> For example, if that is the case, what is the next step to add it to
> DOM?
>
> Something like Erik showed?
>
>     $(inputBox).appendTo('#myForm');
>
> Thanks Karl.
>
> --
> HLS
>
>
>

Reply via email to