Since this question arises when the user is searching custom tooltip, I would like to add a JS popup hint to the bootstrap, although you mentioned pure javascript. Thus, in a sense, this answer is just to give future readers another nice option to work with.
. , , Bootstrap JS Tooltip.
tryit :
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
.test+.tooltip>.tooltip-inner {
background-color: #73AD21;
color: #FFFFFF;
border: 1px solid green;
padding: 15px;
font-size: 20px;
}
.test+.tooltip.top>.tooltip-arrow {
border-top: 5px solid green;
}
.test+.tooltip.bottom>.tooltip-arrow {
border-bottom: 5px solid blue;
}
.test+.tooltip.left>.tooltip-arrow {
border-left: 5px solid red;
}
.test+.tooltip.right>.tooltip-arrow {
border-right: 5px solid black;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h3>Tooltip CSS Example</h3>
<ul class="list-inline">
<li><a class="test" href="#" data-toggle="tooltip" data-placement="top" title="Hooray!">Top</a></li>
<li><a class="test" href="#" data-toggle="tooltip" data-placement="bottom" title="Hooray!">Bottom</a></li>
<li><a class="test" href="#" data-toggle="tooltip" data-placement="left" title="Hooray!">Left</a></li>
<li><a class="test" href="#" data-toggle="tooltip" data-placement="right" title="Hooray!">Right</a></li>
</ul>
</div>
</body>
</html>
P.S.: , , , , , , custom tooltip .