Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
9
rated 0 times [  15] [ 6]  / answers: 1 / hits: 21987  / 14 Years ago, thu, march 17, 2011, 12:00:00

I have a set of bullets, and I'd like to create a tooltip when I mouse over each of them individually. The tooltip text can be the bullets title tag, and it needs to be outputted into a tooltip container. Newbie to javascript so this is where I need the help.



Here's my CSS:



.container ul { width: 300px; height: 30px; display: block; background: #CCC;  }
.container li { width: 28px; height: 28px; display: block; float: left; border: 1px solid #FFF; }
.tooltip { width: auto: height: 12px; display: block; }


My HTML:



<div id=tooltip class=tooltip></div>
<div class=container>
<ul>
<li class=book title=book></li>
<li class=movie title=movie></li>
<li class=tv title=tv></li>
</ul>
</div>


And my javascript:



<script>
$(document).ready(function(){
$(ul li).mouseover(function() {
$(#tooltip).text($(this).attr(title));
});
});
</script>

More From » text

 Answers
42

change from



$(#tooltip).text(this.val(alt))



to



$(#tooltip).text($(this).attr('alt'));


[#93232] Wednesday, March 16, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kourtney

Total Points: 368
Total Questions: 103
Total Answers: 85

Location: Bonaire
Member since Sat, May 1, 2021
3 Years ago
kourtney questions
Sun, Oct 4, 20, 00:00, 4 Years ago
Tue, Oct 29, 19, 00:00, 5 Years ago
Thu, Apr 4, 19, 00:00, 5 Years ago
Fri, Mar 1, 19, 00:00, 5 Years ago
;