This is exactly how I do it. I don't even append the new element until it
has been fully populated or manipulated.  I don't want my users to see a
half way completed div if some procedure takes longer than expected.

*Matt Penner**
*Database Engineer II
GIS Support
[EMAIL PROTECTED]
(951) 940-6108 x10709
 ------------------------------

*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Karl Swedberg
*Sent:* Monday, August 20, 2007 10:21 AM
*To:* [email protected]
*Subject:* [jQuery] Re: Get the element that's appended directly without
using second step?

You could do it like this, perhaps:

var $testDiv = $("<div class='testDiv'></div>").appendTo(
window.document.body);

Is that what you're looking for?

--Karl

_________________

Karl Swedberg

www.englishrules.com

www.learningjquery.com

   On Aug 20, 2007, at 11:47 AM, Jay W wrote:

With the help from a few jQuery'ers, the only way to dynamically

create and append element using jQuery for multiframe application is

$(window.document.body).append("<div class='testDiv'></div>");

This jQuery statement returns window.document.body object.

There will be quite a few elements created this way in a same

document, it will be confusing to use array index to retrieve the

newly created element. So the question is: if I want to get that newly

created object directly, what's the correct way to do it?

Thanks.

Reply via email to