Wednesday, October 9, 2013

Disable Native tooltip in HTML with help of JQuery

This will remove the title attribute on mouseover and then adds the title back on mouse out.

$(document).ready(function() {
    $('[title]').mouseover(function () {
        $this = $(this);
        $this.data('title', $this.attr('title'));
        // Using null here wouldn't work in IE, but empty string will work just fine.
        $this.attr('title', '');
    }).mouseout(function () {
        $this = $(this);
        $this.attr('title', $this.data('title'));
    });
});


No comments:

Post a Comment