2017-04-11 121 views
1

我是jquery的新手,这个问题与jquery相比更加相关。任何帮助表示赞赏。jquery tooltipster插件不能正常工作

我使用Tooltipster Plugin创建工具提示,每次我将鼠标悬停在数据表中的<td>元素上时。为此,我已将数据表中的每一行循环,然后使用子节点选择<td>元素,并应用.tooltipster()函数。但是,工具提示仅适用于第1行<td>元素。任何想法如何让它适用于所有行?

$('#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 
} 

}); 
}); 

表数据

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

如果你只需要一个小文本作为工具提示,那么使用“title”而不是tooltip,这将会更容易和简单。 –

+0

你为什么又问这个问题?我在另一个回答。 –

回答

0

这是给你的建议。

如果您只需显示文本作为您的元素的工具提示,那么只需使用title。

标题的使用很简单。

例如,

HTML

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

截图

sample screenshot

这将是一个简单的步骤,以解决您的问题。