Can someone give me an example of adding a tooltip whenever I hover a td
in a table
.
The content of the tooltip must come from database records.
Example:
If I hover A name on a table.. the tooltip must display his/her information.
The title attribute on a <td> tag adds a tooltip with title text to the table data cell. Hovering the mouse over the table cell will display the tooltip.
Create a HTML table. Create a <span> element in the table cell in which we want to add a tooltip. Initially set the display: none of the <span> element. Whenever the user hovers over this particular element, Just change the property to display: block.
Basic Tooltip 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" .
Use the title
attribute:
<table> <tr> <td> <a href="#" title="John Smith lives in New York."> John Smith </a> </td> </tr> </table>
Live demo: http://jsfiddle.net/GpU5f/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With