Hi all,  Is there a way to replace an element in the DOM tree.

For example:

Starting with...

<div id="parent">
 <div id="child1">Child 1</div>
 <div id="child2">Child 2</div>
 <div id="child3">Child 3</div>
</div>

Assuming a command like "replace( content )" existed...

$("#child2").replace("<span id="newSpan">Text</span>");

Would result in...

<div id="parent">
 <div id="child1">Child 1</div>
 <span id="newSpan">Text</span>
 <div id="child3">Child 3</div>
</div>

The solution could be a series of commands, I don't care, but I'm under the
following restrictions.
 1. I might not know the id of the parent
 2. I need to keep the replaced elements in the same order as the original
elements.

Anyone have a solution that could get this to work?

Thanks in advance,
Galen
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to