2017-04-11 8 views
1

저는 jquery에 초보자입니다.이 질문은 jquery보다 javascript와 더 관련이 있습니다. 어떤 도움을 주셔서 감사합니다.jquery 툴팁 플러그인이 작동하지 않습니다.

데이터 테이블의 <td> 요소 위로 마우스를 가져갈 때마다 Tooltipster Plugin을 사용하여 툴팁을 만듭니다. 이렇게하려면 데이터 테이블의 각 행을 반복 한 다음 자식 노드를 사용하여 <td> 요소를 선택하고 .tooltipster() 함수를 적용했습니다. 그러나 툴팁은 첫 번째 행 <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

작은 텍스트를 도구 설명으로 사용하면 툴팁 대신 "제목"을 사용하면 더 쉽고 간단 해집니다. –

+0

왜이 질문을 다시 했습니까? 나는 다른 하나에 대답했다. –

답변

0

이것은 당신을위한 제안입니다.

요소에 대한 도구 설명으로 텍스트 만 표시하면 title을 사용하면됩니다.

제목의 사용법은 간단합니다. 예를 들어

,

HTML

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

스크린 샷

sample screenshot

는이 문제를 해결할 수있는 간단한 단계가 될 것입니다.