I am trying to display table
as a tooltip
content.
However the table doesn't seem to show.
Here's the HTML:
<td>
<a href="javascript:void(0);" data-toggle="tooltip1" class="red-tooltip" title="">5 Users</a>
</td>
The table:
<table id="tooltipContent" border="4" bordercolor="black" cellspacing="1" cellpadding="15px" style="width: 800px; display: none;">
<tr><td>ravi_shrestha(r_sth@gmail.com)</td></tr>
<tr><td>ravi_shrestha(r_sth@gmail.com)</td></tr>
<tr><td>ravi_shrestha(r_sth@gmail.com)</td></tr>
</table>
Tooltip initialization:
"fnDrawCallback": function( settings ) {
$('[data-toggle="tooltip1"]').tooltip({
content: $('#tooltipContent').html()
});
},
Putting something in title
attribute itself is working though.
Try using a callback function, properly add the js and css dependencies
$('[data-toggle="tooltip1"]').tooltip({
content: function() { return $('#tooltipContent').html();}
});
$('[data-toggle="tooltip1"]').tooltip({
content: function() {
return $('#tooltipContent').html();
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<td>
<a href="javascript:void(0);" data-toggle="tooltip1" class="red-tooltip" title="">5 Users</a>
</td>
<table id="tooltipContent" border="4" bordercolor="black" cellspacing="1" cellpadding="15px" style="width: 800px; display: none;">
<tr>
<td>ravi_shrestha(r_sth@gmail.com)</td>
</tr>
<tr>
<td>ravi_shrestha(r_sth@gmail.com)</td>
</tr>
<tr>
<td>ravi_shrestha(r_sth@gmail.com)</td>
</tr>
</table>