I am trying to make a tooltip in plain JavaScript which is shown on hover. Like the one in Stack Overflow on hover over the profile name a div is s
I was looking for something like this, and i came across this page. It helpd me, but i had to fix your code, for it to work. I think that this is what you tried. You have to refference your objects by their "ID". Here is what I've done, and it works:
HTML
NAME
PROFILE DETAILS
NAME 2
PROFILE DETAILS 2
NAME 3
PROFILE DETAILS 3
CSS
.name{
float:left;
margin:100px;
border:1px solid black;
}
.tooltip{
position:absolute;
margin:5px;
width:200px;
height:50px;
border:1px solid black;
display:none;
}
JS
function show (elem) {
elem.style.display="block";
}
function hide (elem) {
elem.style.display="";
}
http://jsfiddle.net/5qbP3/28/