Hide native tooltip using jQuery

后端 未结 11 801
南旧
南旧 2020-12-01 05:00

Is there a way to hide the native tooltip action when a user hovers over a anchor tag with a title attribute? I don\'t want to remove it just don\'t display the nasty yellow

11条回答
  •  情深已故
    2020-12-01 05:07

    var tempTitle = "";
    $('a[title]').hover(
        function(e){
             e.preventDefault();
             tempTitle = $(this).attr('title');
    
             $(this).attr('title', '');
    
                 $(this).mousedown(
                    function(){
                        $(this).attr('title', tempTitle);
                    }
                );
        }
       ,
       function() {
           $(this).attr('title', tempTitle);
       }
    );
    

    Try it works like a dog!

提交回复
热议问题