My current objective involves dynamically creating div
elements and populating them with items. A working demo of my progress can be found by following this link.
The issue at hand is that the newly created div
does not appear in the desired location, but rather ends up being displayed at the bottom. I'm looking for a way to have the new div
show up right next to the element that is being hovered over. Is there a solution to achieve this?
$(".bubble").live({
mouseenter : function() {
$("#bubble").show();
$("#bubble").html($(this).attr('id'));
},
mouseleave : function() {
$("#bubble").empty();
}
});
#bubble{
width:100px;
height:20px;
background-color:#666666;
position:absolute;
display:hidden;
}
<ul>
<li><span class="bubble" id="test1">test1</span></li>
<li><span class="bubble" id="test2">test2</span></li>
<li><span class="bubble" id="test3">test3</span></li>
<li><span class="bubble" id="test4">test4</span></li>
<li><span class="bubble" id="test5">test5</span></li>
</ul>
<div id="bubble"></div>