# How to add link\_to\_remote element with RJS?

**URL:** <https://www.ruby-forum.com/t/how-to-add-link-to-remote-element-with-rjs/143981>\
**Category:** Rails\
**Created:** [July 24, 2008, 11:24am UTC](https://www.ruby-forum.com/t/how-to-add-link-to-remote-element-with-rjs/143981 "2008-07-24T11:24:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e274bd/32.png) [@eyp](https://www.ruby-forum.com/u/eyp)\
**Post date:** [July 24, 2008, 11:24am UTC](https://www.ruby-forum.com/t/how-to-add-link-to-remote-element-with-rjs/143981/1 "2008-07-24T11:24:21Z")

</div>

Hello,

after executing an action, I add an

- element to an existing list  
using a RJS template:

page.insert\_html :bottom, :contributors, “#{@contributor.user.name}

”

but I need to add an image with a link\_to\_remote as I have in a  
partial page:

```
  <li id="contributor.<%= contributor.id %>">
      <%= link_to_remote image_tag('delete.png', :size =>

```

‘16x16’, :alt =\> ‘Destroy’),  
:url =\> {:action =\>  
“delete\_contributor”, :id =\> @project,  
:contributor\_id =\>  
contributor.id},  
:method =\> :put %\>  
\<%= contributor.user.name %\>

How could I do this with RJS?, is it possible?

---

<div class="post-metadata">

**Author:** ![eyp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e274bd/32.png) [@eyp](https://www.ruby-forum.com/u/eyp)\
**Post date:** [July 24, 2008, 6:16pm UTC](https://www.ruby-forum.com/t/how-to-add-link-to-remote-element-with-rjs/143981/2 "2008-07-24T18:16:53Z")

</div>

On Thu, Jul 24, 2008 at 4:23 AM, Eduardo Yáñez Parareda  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> partial page:
> 
> How could I do this with RJS?, is it possible?

Try using a partial

page.insert\_html :bottom, :contributors, :partial =\> ‘partial\_name’

---

<div class="post-metadata">

**Author:** ![eyp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e274bd/32.png) [@eyp](https://www.ruby-forum.com/u/eyp)\
**Post date:** [July 24, 2008, 6:39pm UTC](https://www.ruby-forum.com/t/how-to-add-link-to-remote-element-with-rjs/143981/3 "2008-07-24T18:39:37Z")

</div>

As far as I know it can be done either way, but I second the partial  
idea. It’ll keep the rjs file a lot cleaner, and be much easier to  
maintain.

– Josh

Christopher Kintner wrote:

> On Thu, Jul 24, 2008 at 4:23 AM, Eduardo Yï¿½ï¿½ez Parareda  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > partial page:
> > 
> > How could I do this with RJS?, is it possible?
> 
> Try using a partial
> 
> page.insert\_html :bottom, :contributors, :partial =\> ‘partial\_name’
