Creating a tooltip plugin

Tooltips are a popular way to show additional information to the user about the UI they are using. This recipe will show you how to create your own basic tooltip plugin that you can easily use in all of your projects.

Getting ready

Copy the jquery.plugin-template.js file and create jquery.tooltip.js, which will become the plugin file for this recipe. Create recipe-2.html and recipe-2.js in the same directory as the plugin file and the jQuery library.

How to do it…

To create a simple tooltip plugin and sample web page, perform the following steps:

  1. Add the following HTML to recipe-2.html to create a very simple web page with elements that can have a tooltip:
    <!DOCTYPE html> <html> <head> <title>Chapter 8 :: Recipe 2</title> <script ...

Get jQuery 2.0 Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.