Tooltip in JavaScript

Tooltip in JavaScript

 
Here we take an example in which we specify the ToolTip in javascript. When we put our mouse over on the paragraph the tooltip will be shown. (Here we take a paragraph as a tooltip.
  1. <html>  
  2.   
  3.    <head>  
  4.       <script type="text/javascript">  
  5.       function getmytooltip(x)   
  6.       {  
  7.          document.getElementById('mytooltip').innerHTML = x;  
  8.       }  
  9.   
  10.       function reset()   
  11.       {  
  12.          document.getElementById('mytooltip').innerHTML = "";  
  13.       }  
  14.       </script>  
  15.    </head>  
  16.   
  17.    <body>  
  18.       <p onmouseover="getmytooltip('My name is mahak garg')" onmouseout="reset()">Mahak</p>  
  19.       <p id="mytooltip"></p>  
  20.    </body>  
  21.   
  22. </html> 
Here mytooltip is the second paragraph which is used as a tooltip.
 
Output:
 
1.png