javascript - How to give tooltip to <th> element of table in HTML - Stack Overflow

How to give tooltip toelement of table while hover the element.<th id="metricsHead">G

How to give tooltip to element of table while hover the element.

<th id="metricsHead">Grade_Desc</th>

While hovering the element the tooltip should be "Grade Description"

How to give tooltip to element of table while hover the element.

<th id="metricsHead">Grade_Desc</th>

While hovering the element the tooltip should be "Grade Description"

Share Improve this question asked Aug 25, 2016 at 6:06 NimmiNimmi 6909 silver badges19 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

Just set the title attribute

<table>
  <th id="metricsHead" title="Grade Description">Grade_Desc</th>
</table>

if you want to set it dynamically

$('#metricsHead').attr('title', "Grade Description")
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
  <th id="metricsHead" >Grade_Desc</th>
</table>

document.getElementById('metricsHead').title = 'your new title';

other option from jquery is

$('#metricsHead').prop('title', 'your new title');

You can set the title attribute with jQuery.

$("#metricsHead").attr("title", "Grade Description");

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744711582a4589374.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信