This worked for me:
var data = ["<div >new-one</div>", "<div >new-two </div>"]
$("#links").empty().append(data.join("")).children();
You are better off using .empty() because .children().remove() will
pushStack and move you off #links. You can get back with .end() but that's a
lot more time, memory, and typing to do what .empty() does.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Will Jessup
Sent: Tuesday, October 17, 2006 9:11 PM
To: jQuery Discussion.
Subject: [jQuery] List - getting children
Hello list,
Have a question about how to grab elements that were put into the DOM w/
.append().
For example,
<div id="links">
<div >one</div>
<div> two </div>
</div>
Then i do this in javascript
$("#links").children().remove(); //removes the divs with "one" and "two"
var data = [<div >one</div>, <div >two </div>]
for (var i=0; i < data.length; i++) {
$("#links").append(data[i][0]);
}
Then try to select them again,
$("#links").children();
Returns nothing
So how do i get it to return the appended items?
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/