You make your life a little more complicated by saying that you donโt want to use any work that other people have already done. :-)
Some of the components:
You can find all ul elements with the title attribute via $ or jQuery :
var targets = $("ul[title]");
You can view them for the mouseenter event, and if the mouseleave event mouseleave not fire for X milliseconds, show your prompt. (These are IE-specific events, but jQuery provides them in all browsers, which is very useful. It also provides hover , which is just a convenient tool for connecting mouseenter and mouseleave .) Although this means that you are connecting a large number of event handlers (since mouseenter and mouseleave not a bubble - part of what makes them so convenient). You might be better off tracking the mouseover / mouseout at the document level and handle the complications as they bubble up.
To show your hint, you can get the location of the corresponding element (via offset ) and show the absolutely located div next to it containing the title (which you can get through attr ).
When the user pulls the mouse out of the tooltip ( mouseleave ), delete it.
But again, you might think about using code from a project that already did this, found all the wrinkles, etc. Read the code first to make sure it does what you want and not what you donโt need, but reinventing the wheel is usually (not always!) A waste of time ... Even if you donโt actually use the plug-in Read to find out what might be helpful.
source share