Click here to Skip to main content
11,488,877 members (78,910 online)
Click here to Skip to main content

Tagged as

jQuery Tooltip

, 6 Jan 2012 CPOL 11.7K 3
Rate this:
Please Sign up or sign in to vote.
In order to add a tooltip to any html element, you need to do the following: - Include the javascript and stylesheet files. The tooltip plugin is implemented in the jqxtooltip.js file. - Add the HTML elements. You need to … Continue reading →

In order to add a tooltip to any html element, you need to do the following:

- Include the javascript and stylesheet files. The tooltip plugin is implemented in the jqxtooltip.js file.

<link rel="stylesheet" href="styles/jqx.base.css" type="text/css" />
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jqxcore.js"></script>
<script type="text/javascript" src="jqxtooltip.js"></script>

- Add the HTML elements. You need to have two things: the elements that show a tooltip when the cursor is placed on top of them and one or many tooltip elements. In this setup there is a single tooltip element with id=’jqxTooltip’ that works for all of the target elements(‘div1′ and ‘div2′):

<div id='jqxTooltip'></div>
<div id='div1' style='background: orange; width: 10px; height: 10px;'></div>
<div id='div2' style='background: blue; margin-top: 20px; width: 10px; height: 10px;'></div>

- Tooltip activation starts by selecting the tooltip element and calling the jqxTooltip constructor.

$("#jqxTooltip").jqxTooltip();

Then you need to call the tooltip’s ‘add’ function and supply two arguments to it – a jQuery selector to the tooltip target element and the tooltip title.

$("#jqxTooltip").jqxTooltip('add', $('#div1'), 'Title1');
$("#jqxTooltip").jqxTooltip('add', $('#div2'), 'Title2');

The default behaviour is that the tooltip is positioned on the bottom/right of the target element.

jquery tooltip

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

jqwidgets
jQWidgets
United States United States
jQWidgets specializes in the development of platform independent and cross-browser compatible presentation layer components for building modern web-based applications for PC, Touch and Mobile. Our product provides developers with the essential set of User Interface widgets needed to streamline their development and reduce project costs.
Our goal is to help our customers deliver better web-based applications that can be accessed through any device and are pleasure to use.
Group type: Organisation

13 members

Follow on   Twitter

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150520.1 | Last Updated 6 Jan 2012
Article Copyright 2012 by jqwidgets
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid