Reputation: 1198
My question is very simple. Below is simple code, in which I have only one span with title. I want to know where can i find the event default tooltip is shows.
<span title="some stubborn tooltip">text</span>
Note: Its not about Jquery or CSS, I am talking about pure JavaScript here.
Thanks in advance
Upvotes: 0
Views: 1008
Reputation: 3360
<span title="some stubborn tooltip" id="demo" onmouseover="mouseOver()" onmouseout="mouseOut()">text</span>
<script>
function mouseOver() {
document.getElementById("demo").style.color = "red";
}
function mouseOut() {
document.getElementById("demo").style.color = "black";
}
</script>
Does this help? It's a simple mouseover and mouseout event.
EDIT You can mimic a custom mouseover and mouseevent like this
EDIT2 as per your comments The implementation for title as a hover text is shipped along with the browser. It depends on the which browser you are using. Some browsers neglect it, some consider only alt
attribute, in some you have to use both alt
and title
together for the tooltip to work.
The fancy tooltips that we see are basically div
s and span
s and other html elements styled accordingly to serve our requirements where in the hover elements are placed on top of other elements using css features like z-index
, postion
etc. The code for implementation of the tooltip which we get by adding title
attribute is shipped with the browser.
Upvotes: 1