Today I met with a serious issue with Bootstrap 4 Tooltip, I think this problem is with other bootstrap versions also.
So the tooltip was not going away when the element is clicked on Internet Explorer – Windows OS and Ipad also. I do not have a Mac but I guess if it is occurring on Ipad and iPhone it will behave the same way on Mac Systems too.
So here is the solution to the tooltip problem:
The tooltip trigger is set to hover and the tooltip is forced to close when the element is clicked.
JavaScript / jQuery used
/* Enable Tooltips */
$(function () {
$('[data-toggle="tooltip"]').tooltip({
trigger : 'hover'
});
$('[data-toggle="tooltip"]').on('click', function () {
$(this).tooltip('hide')
});
});
DEMO
Open demo in a full window – https://demos.webdevpuneet.com/set1/bootstrap-tooltip-hide-on-click/index.html
DEMO Source
<!-- Code by webdevpuneet.com -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Tooltip – Hide on click Issue</title>
<meta name="description" content="Bootstrap Tooltip – Hide on click Issue" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="INDEX,FOLLOW" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<h1>Bootstrap Tooltip – Hide on click Issue</h1>
<div class="demo" style="margin-bottom:20px;">
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">
Tooltip on top
</button>
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="right" title="Tooltip on right">
Tooltip on right
</button>
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">
Tooltip on bottom
</button>
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="left" title="Tooltip on left">
Tooltip on left
</button>
<script>
/* Enable Tooltips */
$(function () {
$('[data-toggle="tooltip"]').tooltip({
trigger : 'hover'
});
$('[data-toggle="tooltip"]').on('click', function () {
$(this).tooltip('hide')
});
});
</script>
</div><!-- End of demo code -->
<div class="article-link" style="margin-bottom:20px;">
<a href="https://webdevpuneet.com/bootstrap-tooltip-hide-on-click-issue-solved/" target="_blank" style="display: inline-block; color:blue:!important;text-decoration: none;border:1px solid blue;color:blue;line-height:1;border-radius:25px;font-size:14px;padding:5px 20px;display:inline-block;">View article and source code »</a>
</div>
</div>
</body>
</html>