$(this).empty().after("<a href='puppy-slides.html?" + href + 
"'>(slides)</a>"

is a line from my dog's home page!

http://jpassoc.com/junior

where this is the old that gets replaced by a different tag!

and nobody will ever see both!

On 1/23/07, Galen Palmer <[EMAIL PROTECTED]> wrote:
> Now that I'm thinking about it, I wonder if somthing like this would work...
>
> $("#child2").after("<div id=\"child2\">New Content</div>").end().remove();
>
> My biggest concern is that for a few milliseconds, two entities with the
> same id would exist (in this case I want to replace a <div> with a new <div>
> with the same id but a different attributes and internal structure).
>
> Another possibility is:
>
> $("#child2").remove().after("<div id=\"child2\">New
> Content</div>");
>
> Anyone tried anything similar?
>
> Thanks again,
> Galen
>
>
> On 1/23/07, Galen Palmer <[EMAIL PROTECTED]> wrote:
> > 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/
>
>
>


-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to