Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Calling Bootstrap Tooltip Methods Using jQuery</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script> <style> .bs-example{ margin: 100px auto; } </style> <script> $(document).ready(function(){ $("#showTooltip").click(function(){ $("#myTooltip").tooltip("show"); }); $("#hideTooltip").click(function(){ $("#myTooltip").tooltip("hide"); }); $("#toggleTooltip").click(function(){ $("#myTooltip").tooltip("toggle"); }); $("#enableTooltip").click(function(){ $("#myTooltip").tooltip("enable"); }); $("#disableTooltip").click(function(){ $("#myTooltip").tooltip("disable"); }); $("#toggleEnabledTooltip").click(function(){ $("#myTooltip").tooltip("toggleEnabled"); }); $("#updateTooltip").click(function(){ $("#myTooltip").tooltip("update"); }); $("#disposeTooltip").click(function(){ $("#myTooltip").tooltip("dispose"); }); }); </script> </head> <body> <div class="bs-example text-center"> <p> <a href="#" data-toggle="tooltip" id="myTooltip" title="This is default title">Hover over me</a> </p> <div class="mt-4"> <p>Click on the following buttons to control the tooltip manually.</p> <button type="button" class="btn btn-primary" id="showTooltip">Show</button> <button type="button" class="btn btn-warning" id="hideTooltip">Hide</button> <button type="button" class="btn btn-success" id="toggleTooltip">Toogle</button> <button type="button" class="btn btn-info" id="enableTooltip">Enable</button> <button type="button" class="btn btn-secondary" id="disableTooltip">Disable</button> <button type="button" class="btn btn-dark" id="toggleEnabledTooltip">Toogle Enabled</button> <button type="button" class="btn btn-warning" id="updateTooltip">Update</button> <button type="button" class="btn btn-danger" id="disposeTooltip">Dispose</button> </div> </div> </body> </html>