On Dec 21, 7:49 am, Dave Methvin <dave.meth...@gmail.com> wrote:
> > Why does replaceAll only seem to work once in this example?
>
> I guess you meant replaceWith?
>
Yes, my mistake.
> > $("#hello").replaceWith("foo");
>
> Once this code executes, it has replaced the element with
> id="hello" (and any children) with the string "foo". There is no
> longer a #hello in the document.
>
> http://docs.jquery.com/Manipulation/replaceWith#content
>
> If you just want to replace the stuff inside #hello, try $
> ("#hello").empty().append("foo") or $("hello").html("foo").
The first one works great.
I had tried both of those(append, empty), but hadn't chained them up
in the manner you described, but had tried to run them in succession
without any luck.
Thanks very much!