views:

42

answers:

2

Hi, I have a page with HTML anchor tags that have the title attribute set.

<a href="...." title="Some tooltip text" />

I want to detect when the tooltip is shown, and run some javascript. This is to log that the tooltip has been displayed. Using OnMouseOver isn't enough since it triggers too early.

Any ideas?

+5  A: 

Mine would be to create your own tooltips that you could append extra 'tracking' to determine if they were displayed or not.

With that library, you could make your own effect that does customized things on the over/out of the tooltip.

Dan Heberden
+1 - Probably the only way to resolve this.
Gert G
A: 

Use JQuery. If you do sth only particular tags you must set your tags id and/or name attributes.

<a href=".." id="x"></a>

The code:

$(document).ready(function () {           

           $("#x").mouseenter(function () {
               alert("yeah");
           });

       });

If you run javascript code for all <a> tags you use this like below.

$(document).ready(function () {


           $("a").mouseenter(function () {
               alert("yeah");
           });

       });

You add this between <head> tags of your page to use JQuery library

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
Judas Imam
"Using OnMouseOver isn't enough since it triggers too early." is what the OP had already said.
Dan Heberden
"Use jQuery" will work 99.99% of the times as an answer. This is one of 0.01% questions.
Anurag