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:
- 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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.