Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Placing HTML inside Bootstrap Popovers Using JavaScript</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script> <style> .bs-example{ margin: 100px 50px; } /* Custom styles for popover */ .custom-title{ margin: 0; } </style> <script> document.addEventListener("DOMContentLoaded", function(){ var element = document.getElementById("myPopover"); var popover = new bootstrap.Popover(element, { title: '<h4 class="custom-title"><i class="bi-info-circle-fill"></i> Popover info</h4>', content: '<p>This is a <em>simple example</em> demonstrating how to insert HTML code inside <strong>Bootstrap popover</strong>.</p>', html: true }); }); </script> </head> <body> <div class="bs-example"> <button type="button" class="btn btn-primary btn-lg" id="myPopover" data-toggle="popover">Click to toggle popover</button> </div> </body> </html>