Reputation: 49364
Is there any way using JQuery to Show the contents of the Title tag added to the <img title
which would have no anchor or if not possible have a div would is hidden show which img is hovered?
Upvotes: 1
Views: 4140
Reputation: 1038710
Normally the title
attribute is interpreted by browsers and shown as tooltip when you hover over the element. So you don't really need jQuery for this.
The problem with this behavior is that you don't really have much control over the formatting of this tooltip. But if you want to show and format this value in some custom section you could subscribe to the .hover()
event of those images:
$(function() {
$('img').hover(function() {
var title = $(this).attr('title');
// TODO: do something with the title
}, function() {
// this will be triggered when the mouse pointer leaves the element
});
});
And if you want some nice looking tooltips, you could use some existing plugins such as qTip.
Upvotes: 4