简体   繁体   English

jquery tooltipster插件无法正常工作

[英]jquery tooltipster plugin not working

I'm a newbie to jquery and this question is more so related to javascript than jquery. 我是jquery的新手,这个问题与javascript有关,而不是jquery。 Any help is appreciated. 任何帮助表示赞赏。

I'm using Tooltipster Plugin to create a tooltip everytime i hover over a <td> element in a datatable. 我每次将鼠标悬停在数据表中的<td>元素上时,我都会使用Tooltipster插件来创建工具提示。 To do so, i have looped over each row in the datatable and then selected the <td> element using childnode, and applied the .tooltipster() function. 为此,我已遍历数据表中的每一行,然后使用childnode选择<td>元素,并应用.tooltipster()函数。 However, the tooltip works only for the 1st row <td> element. 但是,工具提示仅适用于第1行<td>元素。 Any idea how to get it working for all rows ? 知道如何让它适用于所有行吗?

 $('#mytable tbody tr').each(function(){
     //childNode[7] is the <td> element on which i want the tooltip
     $(this.childNodes[7]).tooltipster({    
            animation: 'fade',
            delay: 200,
            theme: 'tooltipster-punk',
            trigger: 'hover',
            interactive: 'true',
            functionBefore : function drawChart() {
  // This isnt needed to understand the problem so i have not pasted the code
}

});
});

Table data 表数据

 <td class="tooltip" data-tooltip-content="#chart_div"  style="padding-left:40px" id="storage" >
        <img src="@Url.Content("~/Content/images/database.png")" />   
 </td>

This is a suggestion for you. 这是对你的建议。

If you just need to show a text as tool-tip for your elements, then simply use title. 如果您只需要将文本显示为元素的工具提示,那么只需使用标题即可。

Usage of title is simple. 标题的使用很简单。

For example, 例如,

HTML HTML

<div title="your tooltip here">The content of the document......</div>

screenshot 截图

示例截图

This will be a simple step to solve your issue. 这将是解决您的问题的简单步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM