# Different mouse event when using link\_to\_remote

**URL:** <https://www.ruby-forum.com/t/different-mouse-event-when-using-link-to-remote/88333>\
**Category:** Rails\
**Created:** [March 9, 2007, 8:27pm UTC](https://www.ruby-forum.com/t/different-mouse-event-when-using-link-to-remote/88333 "2007-03-09T20:27:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/94ad74/32.png) [@Steven](https://www.ruby-forum.com/u/Steven)\
**Post date:** [March 9, 2007, 8:27pm UTC](https://www.ruby-forum.com/t/different-mouse-event-when-using-link-to-remote/88333/1 "2007-03-09T20:27:23Z")

</div>

Anybody a have better method for having an onmouseover (or any event).  
This is the method used but its not as pretty and has to be done for  
every mouse event.

```
  def link_to_remote_mover(name, options = {}, html_options = {})
    link_to_function_mover(name, remote_function(options),

```

html\_options)  
end

```
  def link_to_function_mover(name, *args, &block)
    html_options = args.last.is_a?(Hash) ? args.pop : {}
    function = args[0] || ''
    html_options.symbolize_keys!
    function = update_page(&block) if block_given?
    content_tag(
      "a", name,
      html_options.merge({
        :href => html_options[:href] || "javascript:void(0)",
        :onmouseover => (html_options[:onmouseover] ?

```

"#{html\_options[:onmouseover]}; " : “”) + “#{function}; return false;”  
})  
)  
end
