Serhii Danovskyi
Serhii Danovskyi

Reputation: 394

Tooltip to disabled button

In

<%= link_to 'New', new_post_path,  
title: "Login or register to create post" , 
rel: "tooltip" , 
class: "btn btn-primary" %>

it work fine , but if i add disabled in not work

<%= link_to 'New', new_post_path,  
title: "Login or register to create post" ,
rel: "tooltip" ,
class: "btn btn-primary disabled" %>

How to add Tooltip to disabled button ?

Upvotes: 1

Views: 1778

Answers (1)

Ben Aubin
Ben Aubin

Reputation: 5657

Disabled isn't a class. It's just a boolean option. Also, Bootstrap hates tooltips on disabled buttons, to solve this, wrap it in a div:

<div title="Login or register to create post" rel="tooltip">
    <%= link_to 'New', new_post_path, class: "btn btn-primary", disabled: true %>
</div>

Upvotes: 2

Related Questions