Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you render tooltip on disabled HTML Button

I have a HTML button. I have tried to render a tooltip on it based on the "title" attribute of the button and it doesn't render. Mainly because it's disabled.

I then tried wrapping the button in a span and setting the "title" attribute of the span.

Hovering over the button that is wrapped in the span still has no effect. The tooltip will render on any other part of the span that is not part of the button tag. Like if I put some text in the span as well as the button, hovering over the text produces the tooltip, but if you hover over the button it will not render.

So: how can I display a tooltip for a disabled button?

like image 544
angryITguy Avatar asked Jan 28 '10 00:01

angryITguy


People also ask

How do I add a tooltip to a button?

To add a tooltip to a button you can use the title attribute on the button element. This will create a tooltip when the user hovers over the button element.

How do I enable tooltip?

How To Create a Tooltip. To create a tooltip, add the data-toggle="tooltip" attribute to an element. Note: Tooltips must be initialized with jQuery: select the specified element and call the tooltip() method.

How do I show tooltip in HTML?

HTML: Use a container element (like <div>) and add the "tooltip" class to it. When the user mouse over this <div>, it will show the tooltip text. The tooltip text is placed inside an inline element (like <span>) with class="tooltiptext" .


1 Answers

I got this working by applying the CSS pointer-events: auto; to the button, though this isn't supported on IE<11.

like image 166
Andrew Magee Avatar answered Sep 28 '22 08:09

Andrew Magee