Glenn Glenn - 6 months ago 30
jQuery Question

How to remove tooltip generated by hover in jquery

I have used hover to display tooltip on hover. However the text keeps getting appended because the function I have written on mouseout is not working.

Below is my code:

var $j = jQuery.noConflict();

$j("#choice30QID404").hover(
function () {
// $j(this).append($("<span> HOVERING!!!!! </span>"));
$j(this).append("<span>HOVERING!!!!!</span>");
});

$j("#choice30QID404").click(function() {
$j(this).mouseout();
});

Answer

You can achieve this simply using title attribute. Unless and until you don't want to customize. I am writing without noConflict()

$('#choice30QID404').mouseover(function() { 
$(this).attr('title','You are Hovering'); 
})

$('#choice30QID404').mouseout(function() { 
$(this).removeAttr('title'); 
})

This will help you.

Comments