# Link\_to\_remote for a div

**URL:** <https://www.ruby-forum.com/t/link-to-remote-for-a-div/103831>\
**Category:** Rails\
**Created:** [May 10, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/link-to-remote-for-a-div/103831 "2007-05-10T20:35:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cfingerh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f14d63/32.png) [@cfingerh](https://www.ruby-forum.com/u/cfingerh)\
**Post date:** [May 10, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/link-to-remote-for-a-div/103831/1 "2007-05-10T20:35:15Z")

</div>

Hi,

i just want to create with Ror an event when a the mouse is over an  
element. Is there any helper function like link\_to\_remote that  
generates the code…  
I need something like this

Some text

Thanks

---

<div class="post-metadata">

**Author:** ![cfingerh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f14d63/32.png) [@cfingerh](https://www.ruby-forum.com/u/cfingerh)\
**Post date:** [May 10, 2007, 9:31pm UTC](https://www.ruby-forum.com/t/link-to-remote-for-a-div/103831/2 "2007-05-10T21:31:23Z")

</div>

cfingerh,

> i just want to create with Ror an event when a the mouse is over an  
> element. Is there any helper function like link\_to\_remote that  
> generates the code…

You are close: look at ‘link\_to\_remote’ source  
[http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005056](http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005056)  
, and you’ll see that it calls ‘remote function’  
[http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005063](http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005063)

## In the view :

\<a onmouseover=“\<%= remote\_function(:url =\> { :action =\> :bar }) %\>”

> foo

## In the controller:

def bar  
render(:update) { |page|  
page.alert(‘bar’)  
}  
end

## Alain

[blog.ravet.com](http://blog.ravet.com)

---

<div class="post-metadata">

**Author:** ![cfingerh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f14d63/32.png) [@cfingerh](https://www.ruby-forum.com/u/cfingerh)\
**Post date:** [May 10, 2007, 11:57pm UTC](https://www.ruby-forum.com/t/link-to-remote-for-a-div/103831/3 "2007-05-10T23:57:39Z")

</div>

When would doing something like that be useful or better than just  
embedding  
the javascript?

Maybe if the stuff that you’d be mousing over was dynamic rather than  
static?

Just curious.

On 5/10/07, Alain R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005056](http://caboo.se/doc/classes/ActionView/Helpers/PrototypeHelper.html#M005056)
> 
> ## Alain
> 
> [blog.ravet.com](http://blog.ravet.com)
> 
> >

–  
Terry (TAD) Donaghe  
[http://tadspot.tumblr.com](http://tadspot.tumblr.com)
