In general
You are looking for the HTML title
attribute. This attribute is valid on any HTML element, as mentioned here: https://www.w3schools.com/tags/att_global_title.asp
In HTML
Thus you can add the title
attribute to any HTML element. For example:
<a href="#" title="This is your tooltip content">Link</a>
I prepared a jsfiddle for you: https://jsfiddle.net/g2106c9e/
In Javascript
You can assign the title
attribute dynamically to any element.
// Get a DOM element
var element = document.getElementById("some-element-id")
// Set this elements title attribute
element.setAttribute("title", "This is your tooltip content")
Here another working jsfiddle: https://jsfiddle.net/p5sLvd63/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…