0

I am having a link_to_remote link - which i want to perform its action on double click...

I am using rails version 2.3.5...

Adam Harte
  • 10,369
  • 7
  • 52
  • 85
Jamal Abdul Nasir
  • 2,557
  • 5
  • 28
  • 47
  • 4
    it is actually about Javascript nor about Rails – fl00r Mar 24 '11 at 09:30
  • so u mean there is no way to do it in rails...i know the javascript way... but i want to do it in rails - if there is any way... otherwise i have to go for javascript then... – Jamal Abdul Nasir Mar 24 '11 at 09:33
  • rails can't do it. rails is server side framework, not client side. – fl00r Mar 24 '11 at 09:34
  • possible duplicate of [Listen to double click not click](http://stackoverflow.com/questions/7897558/listen-to-double-click-not-click) – Servy Aug 13 '12 at 15:42

1 Answers1

1

You can use jQuery dblclick

http://api.jquery.com/dblclick/

# Rails 3
<%= link_to "link", :remote => true, :id => "my_link" %>

# Rails 2.x
<%= link_to_remote "my_link", {}, {:id => "my_link"} %>

<script>
  $('#my_link').dblclick(function() {
    alert('Hello world!');
  });
</script>

you need just to add jquery support to your app

fl00r
  • 82,987
  • 33
  • 217
  • 237