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.
jquery.plugin-template.js file and create
jquery.tooltip.js, which will become the plugin file for this recipe. Create
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:
- Add the following HTML to
recipe-2.htmlto create a very simple web page with elements that can have a tooltip:
<!DOCTYPE html> <html> <head> <title>Chapter 8 :: Recipe 2</title> <script ...