Download ToolTip

ToolTip is a script that can be used to make a tooltip immediately appear when a user mouses over an element that has a 'tip' attribute set. The ToolTip will follow the mouse for as long as the user remains over the element. All you have to do is something like this:

<p tip="Here's a tip!">Here's my paragraph.</p>

You can customize the script by assigning your own style to the tooltip as well as setting a maximum width. Here are a few examples of the script in action:

This text is inside of a span tag with a tip, mouseover it to see the tip

This text is inside of a div tag with a tip.
Notice that the tip shows up anywhere within the rectangle.

When you approach to edge of the window...

It is also possible to use this script with elements that are dynamically added to the document. You can do something like this:

var myDiv = document.createElement('div');
myDiv.onmouseover = showTip;
myDiv.onmouseout = hideTip;
myDiv.tip = "Here's my tip.";
myDiv.innerHTML = "Here's my content.";
document.appendChild(div);