Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap 4 Popover Methods</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css"> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"></script> <style> .bs-example{ margin: 100px 20px; } </style> <script> $(document).ready(function(){ $(".show-popover").click(function(){ $("#myPopover").popover('show'); }); $(".hide-popover").click(function(){ $("#myPopover").popover('hide'); }); $(".toggle-popover").click(function(){ $("#myPopover").popover('toggle'); }); $(".enable-popover").click(function(){ $("#myPopover").popover('enable'); }); $(".disable-popover").click(function(){ $("#myPopover").popover('disable'); }); $(".toggle-enabled-popover").click(function(){ $("#myPopover").popover('toggleEnabled'); }); $(".toggle-update").click(function(){ $("#myPopover").popover('update'); }); $(".destroy-popover").click(function(){ $("#myPopover").popover('dispose'); }); }); </script> </head> <body> <div class="bs-example"> <div class="mb-5"> <button type="button" class="btn btn-primary btn-lg" id="myPopover" title="Popover title" data-toggle="popover" data-content="And here's some amazing content. It's very engaging.">Popover Example</button> </div> <div class="popover-controls"> <p>Click on the following buttons to control the popover manually.</p> <button type="button" class="btn btn-primary show-popover">Show</button> <button type="button" class="btn btn-warning hide-popover">Hide</button> <button type="button" class="btn btn-success toggle-popover">Toogle</button> <button type="button" class="btn btn-info enable-popover">Enable</button> <button type="button" class="btn btn-secondary disable-popover">Disable</button> <button type="button" class="btn btn-dark toggle-enabled-popover">Toogle Enabled</button> <button type="button" class="btn btn-warning update-popover">Update</button> <button type="button" class="btn btn-danger destroy-popover">Destroy</button> </div> </div> </body> </html>