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. <head>
  3. <script type="text/javascript">
  4. function getmytooltip(x)
  5. {
  6. document.getElementById('mytooltip').innerHTML = x;
  7. }
  8. function reset()
  9. {
  10. document.getElementById('mytooltip').innerHTML = "";
  11. }
  12. </script>
  13. </head>
  14. <body>
  15. <p onmouseover="getmytooltip('My name is mahak garg')" onmouseout="reset()">Mahak</p>
  16. <p id="mytooltip"></p>
  17. </body>
  18. </html>
Here mytooltip is the second paragraph which is used as a tooltip.
Output:
1.png