JQuery: Displaying a Tooltip


/ Published in: jQuery
Save to your folder(s)

I know that there are other ways of displaying a tooltip without the use of JQuery but I like the flexibility and control JQuery provides. This snippet shows how to add a tooltip to a Help icon.


Copy this code and paste it in your HTML
  1. <!-- This sets up a button with a help icon next to it -->
  2. <input type="button" id="cascade" class="StandardButton" value="Cascade" />&nbsp;<img id="help" src="~/Images/help_icon.jpg" border="0" />
  3.  
  4. <!-- This is the jquery code to add a tooltip to the help icon -->
  5. $(document).ready(function() {
  6. $('#help').tooltip(
  7. {
  8. delay: 0,
  9. bodyHandler: function() { return "Click this button to cascade your selection<br /> from its current level through all levels below."; },
  10. showURL: false
  11. })
  12. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.