# Link\_to\_remote with anchor

**URL:** <https://www.ruby-forum.com/t/link-to-remote-with-anchor/77413>\
**Category:** Rails\
**Created:** [November 27, 2006, 7:27pm UTC](https://www.ruby-forum.com/t/link-to-remote-with-anchor/77413 "2006-11-27T19:27:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![giantcranes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecd19e/32.png) [@giantcranes](https://www.ruby-forum.com/u/giantcranes)\
**Post date:** [November 27, 2006, 7:27pm UTC](https://www.ruby-forum.com/t/link-to-remote-with-anchor/77413/1 "2006-11-27T19:27:03Z")

</div>

Hi,

I would like to jump to an anchor on a page once an AJAX action has been  
performed (a new page of data has been returned and I would like to  
present the top of this list to the user).

Is there a way to specify an anchor in link\_to\_remote? If not, is there  
something that I can do in the RJS template?

Thanks,  
GiantCranes

---

<div class="post-metadata">

**Author:** ![giantcranes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecd19e/32.png) [@giantcranes](https://www.ruby-forum.com/u/giantcranes)\
**Post date:** [June 20, 2008, 9:39pm UTC](https://www.ruby-forum.com/t/link-to-remote-with-anchor/77413/2 "2008-06-20T21:39:22Z")

</div>

Giant C. wrote:

> Hi,
> 
> I would like to jump to an anchor on a page once an AJAX action has been  
> performed (a new page of data has been returned and I would like to  
> present the top of this list to the user).
> 
> Is there a way to specify an anchor in link\_to\_remote? If not, is there  
> something that I can do in the RJS template?
> 
> Thanks,  
> GiantCranes

I’ve found that typically you can add :html=\>{} block to edit most HTML  
related elements. in this case you can add :html =\>{:href =\>  
“#anchor\_name”} to your link\_to\_remote.

example :  
link\_to\_remote “link text”, :update =\> “element”,  
:html =\> {:href =\> “#bottom\_anchor”},  
:url =\> { :controller =\> “your\_controller”,  
:action =\> “your\_action”},  
:loading =\> “$(‘spinner’).show();”
