# Link\_to\_remote inserting instead of replacing

**URL:** <https://www.ruby-forum.com/t/link-to-remote-inserting-instead-of-replacing/136740>\
**Category:** Rails\
**Created:** [May 6, 2008, 12:59am UTC](https://www.ruby-forum.com/t/link-to-remote-inserting-instead-of-replacing/136740 "2008-05-06T00:59:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emuen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@emuen](https://www.ruby-forum.com/u/emuen)\
**Post date:** [May 6, 2008, 12:59am UTC](https://www.ruby-forum.com/t/link-to-remote-inserting-instead-of-replacing/136740/1 "2008-05-06T00:59:45Z")

</div>

Hi guys.

Is there anyone, that have a good explanation for this: I have a  
link\_to\_remote function that has the :update tag pointing to the  
“pages\_content” div, but instead of replacing the content it simply  
inserts it in the top of the div. Why is this? Should the target content  
not be totally replaced?

- Emil

---

<div class="post-metadata">

**Author:** ![emuen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@emuen](https://www.ruby-forum.com/u/emuen)\
**Post date:** [May 6, 2008, 10:23am UTC](https://www.ruby-forum.com/t/link-to-remote-inserting-instead-of-replacing/136740/2 "2008-05-06T10:23:30Z")

</div>

On 5 May 2008, at 23:59, Emil K. wrote:

> Hi guys.
> 
> Is there anyone, that have a good explanation for this: I have a  
> link\_to\_remote function that has the :update tag pointing to the  
> “pages\_content” div, but instead of replacing the content it simply  
> inserts it in the top of the div. Why is this? Should the target  
> content  
> not be totally replaced?

Link to remote knows how to do both, so there’s a small chance you  
accidentally asked it to do that. A more likely possibility is that  
your html is invalid (which puts you at the mercy of how the browser  
chooses to interpret it).

Fred

---

<div class="post-metadata">

**Author:** ![emuen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@emuen](https://www.ruby-forum.com/u/emuen)\
**Post date:** [May 6, 2008, 6:59pm UTC](https://www.ruby-forum.com/t/link-to-remote-inserting-instead-of-replacing/136740/3 "2008-05-06T18:59:48Z")

</div>

I agree. And a good tool to verify this is with the Firebug plugin for  
firefox. You can use a console against the currently loaded page (dom)  
and  
see if getElementById returns you an array or a single element.

On Tue, May 6, 2008 at 4:22 AM, Frederick C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > ## inserts it in the top of the div. Why is this? Should the target
> > 
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> > 
> > >
> 
> >

–  
James M.
