How to disable tooltip in the browser with jQuery?

后端 未结 7 1877
名媛妹妹
名媛妹妹 2020-11-29 06:11

Is there a way to disable browser tooltip from displaying when hovering over elements that have attribute \'title\' populated? Note that I don\'t want to remove title conten

7条回答
  •  温柔的废话
    2020-11-29 06:37

    Following Dan Herbert's suggestion above, here is the code:

    $(element).hover(
        function () {
            $(this).data('title', $(this).attr('title'));
            $(this).removeAttr('title');
        },
        function () {
            $(this).attr('title', $(this).data('title'));
        });
    

提交回复
热议问题