【问题标题】:how to show tooltip on cell hover using jquery如何使用jquery在单元格悬停时显示工具提示
【发布时间】:2012-10-29 07:22:12
【问题描述】:

see in jsfiddle 在单元格的鼠标悬停时,我必须使用 jquery 在工具提示中显示名称

像这样 约翰 固定

 <td class="csstdRed" valign="top"><span id=32>John</span></td>

【问题讨论】:

    标签: jquery


    【解决方案1】:

    我已经编辑了您的 JFiddle 代码。这是我添加的内容

    $('#tableAppointment td[title]')
        .hover(function() {
            showTooltip($(this));
        }, function() {
            hideTooltip();
        })
    ;
    
    function showTooltip($el) {
        // insert code here to position your tooltip element (which i'll call $tip)
        $tip.html($el.attr('title'));
    }
    function hideTooltip() {
        $tip.hide();
    }
    

    然后在 td 中添加 Title

    <td class="csstdRed" title="John Fixed" valign="top"><span id=32>John</span></td>
    

    希望这会对您有所帮助。我从How to add a Tooltip to a "td" with jquery? 得到这个想法,我想这就是你想要的。

    谢谢..

    【讨论】:

    • Dilip john 文本在我的问题中跨度不在标题中
    • 是否要将 span 显示为工具提示啊?
    • 好的,我知道了.. 让我检查一下,过一段时间再告诉你。
    猜你喜欢
    • 1970-01-01
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    • 2022-09-29
    • 2018-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多