Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap tooltip on method => :delete link in Rails

I'm using method: :delete on a link in rails, and trying to get a bootstrap tooltip on it.

This doesn't show a tooltip:

=link_to "destroy", blog_path(blog), "data-original-title" => "Delete your answer", "data-placement" => "top", :rel => "tooltip", method: :delete

However, if I remove the method: :delete, the tooltip works.

How can I get a tooltip on a delete link?

like image 925
bevanb Avatar asked Aug 31 '12 21:08

bevanb


1 Answers

This is a JQuery selector problem.

If you use something like:

$('a[rel="tooltip"]').tooltip();

You're telling the JQuery selector to take the only the elements with rel attribute with only "tooltip" value.

So I believe what you're looking for is this piece of code.

$('a[rel~="tooltip"]').tooltip();

So, now JQuery will take all the elements that has the "tooltip" word inside the rel attribute.

More information below.

http://api.jquery.com/attribute-contains-word-selector/

like image 102
guivinicius Avatar answered Sep 23 '22 09:09

guivinicius