Aivan Sixcks
Aivan Sixcks

Reputation: 23

jQuery Tools tooltip problem - jQuery

jQuery:

$(function() {
$("img").tooltip();
$("a").tooltip();
})

HTML:

<div id="container">
<div id="main">
<a href="#">testing</a>
<img src="trollface.jpg" title="Hello, imma trollface!" />
</div>
</div>

In the above case, tooltip works only on <img> tag.

I haven't added any CSS on <img> or <a>.

$("a").hover(
function() {
    $(this).animate({color: "white"}, 400);
}, function() {
    $(this).animate({color: "black"}, 400);
})

The above, however, doesn't work now.

Upvotes: 1

Views: 875

Answers (1)

Joe Landsman
Joe Landsman

Reputation: 2177

By default the tooltip() method will display content contained in the elements "title" attribute. Since your <a> doesn't have a title attribute, the tooltip is not displaying anything. If you add a title attribute to that tag like this:

<a href="#" title="This is my anchor tag">testing</a>

It should work.

Upvotes: 1

Related Questions