ToolTip Behavior

This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.

Adds a rich HTML ToolTip control to the document.


XML <Prefix: CustomTag ID=sID STYLE="behavior:url('')" />
HTML <ELEMENT STYLE="behavior:url('')" ID=sID>
Scripting object .style.behavior = "url('')"
object .addBehavior ("")

Possible Values

Prefix Prefix that associates the CustomTag with an XML namespace. This prefix is set using the XMLNS attribute of the HTML tag.
CustomTag User-defined tag.
sID String that specifies a unique identifier for the object.

Members Table

The following table lists the members exposed by the ToolTip object.

Attribute Property Description
AVOIDMOUSE avoidMouse Sets or retrieves whether the ToolTip behavior moves away from the mouse cursor.
DELAY delay Sets or retrieves the amount of time, in milliseconds, before showing the ToolTip.
DURATION duration Sets or retrieves how long the ToolTip is displayed, in seconds.
ELEMENT element Sets or retrieves the ID attribute of the object that uses the ToolTip behavior.
Event Property Description
onerror Fires when a property is assigned an invalid value, or the property is read-only, for the ToolTip behavior.
onhide Fires when the ToolTip behavior is no longer visible.
onshow Fires when the ToolTip is displayed for the ToolTip behavior.


The behavior-defined members listed in the preceding table are not accessible through script until the window. onload event fires. Waiting for this event to fire ensures that the document is completely loaded, that all behaviors have been applied to corresponding elements on the document , and, consequently, that all the behavior's properties, methods, and events are available for scripting. Attempting to use any of the behavior-defined members will result in a scripting error indicating that the object does not support that particular member.

When the mouse cursor hovers over the element participating in the ToolTip behavior, the ToolTip will appear after the amount of time specified in the DELAY attribute. The ToolTip appears at the bottom-right corner of the mouse and disappears after the amount of time specified by the DURATION attribute, or when the mouse cursor moves outside the element, unless the mouse cursor moves over the ToolTip and the AVOIDMOUSE attribute is set to 1. To prevent a ToolTip from appearing on certain elements, existing TITLE and ALT attribute values are cleared for the object participating in the behavior. The behavior allows authors to attach the ToolTip to a collection of elements, when there is more than one element with the same ID.

The file can be downloaded from the ToolTip  sample page.

In addition to the members and styles previously listed, the ToolTip behavior supports:


This sample demonstrates the implementation and adjustments of the ToolTip behavior.

<HTML XMLNS:Tooltip>
@media all{
   tooltip\:tip{behavior: url("/behaviors/");}
<tooltip:tip element = "oDIV">    
<b>ToolTip text.<b>

<DIV ID = "oDIV">
This DIV has a ToolTip.

Code example:

See Also

Community Additions