Search code examples
ruby-on-railsrubytooltip

How to add tooltip with link_to_remote image_tag in ruby on rails?


i want show tooltip with image tag and i have written code like below but i am not able to get tooltip while mouseover...

Code:

<%= link_to_remote image_tag('../images/save_active.gif',:method => "post",:tooltip=>"Save", :border => 0), :url => {:controller => "ptcgeodatabase" } %>

Solution

  • Unless you're using a javascript library to generate tooltips specially, you need to use the title attribute on your a element (I've split this onto multiple lines for readability):

      <%= link_to_remote image_tag('../images/save_active.gif', 
                               :method => "post", 
                               :border => 0),
                     :url => { :controller => "ptcgeodatabase" },
                     :html => { :title => "Save" } %>