content logo

Bootstrap Popups:

Custom Bootstrap 5 Popover

The bootstraps that increase the space of your website are so helpful and it is better to use them in order to gain many visitors. In this post, you can see the Custom Bootstrap 5 Popover with a nice theme. If you use this Bootstrap Popover Code, you can reduce using the menus and texts on the main pages of the websites. This Search Popover Code allows you to find your needed information and content in a short time. In other words, you can save your time and search for what you want easily.

We have prepared the preview of this code below and you can see its different items. As it appears, this HTML Simple Popover has a dark green background and you can use it if you have a simple website. You can see a button in the center of the page with a red background and white text. After putting the mouse cursor on this button, its red background turns darker in this JavaScript Popover. If you click on this section, a white field will appear at the top of this button. This field is designed for searching for different factors. You can type your needed information in this field and click on the red button with the search icon.

#

Bootstrap Popover Code

#

Search Popover Code

#

HTML Simple Popover

#

Javascript Popover

<!-- This script got from frontendfreecode.com -->
<section class="center">
    <div hidden>
        <div data-name="popover-content">
            <div class="input-group">
                <input type="text" class="form-control form-control-sm" placeholder="Search" name="search">
                <div class="input-group-btn">
                    <button class="btn btn-danger" type="submit">
                        <i class="bi bi-search fa fa-search"></i>
                    </button>
                </div>
            </div>
        </div>
    </div>
    <a id="example" tabindex="0" class="btn btn-lg btn-danger" role="button" data-bs-toggle="popover" title="Default: Html inside popover">Html inside popover</a>
</section><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
html, body {
    color: goldenrod;
    background-color: darkslategray;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}
$(document).ready(function () {
    var options = {
        html: true,
        title: "Optional: HELLO(Will overide the default-the inline title)",
        content: $('[data-name="popover-content"]')
    }
    var exampleEl = document.getElementById('example')
    var popover = new bootstrap.Popover(exampleEl, options)
})
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css' rel='stylesheet'>
<link href='https://use.fontawesome.com/releases/v5.7.2/css/all.css' rel='stylesheet'>
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js'></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css' rel='stylesheet'>
<link href='https://use.fontawesome.com/releases/v5.7.2/css/all.css' rel='stylesheet'>
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js'></script>
<style>
html, body {
    color: goldenrod;
    background-color: darkslategray;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}
</style>

</head>
<body>
<section class="center">
    <div hidden>
        <div data-name="popover-content">
            <div class="input-group">
                <input type="text" class="form-control form-control-sm" placeholder="Search" name="search">
                <div class="input-group-btn">
                    <button class="btn btn-danger" type="submit">
                        <i class="bi bi-search fa fa-search"></i>
                    </button>
                </div>
            </div>
        </div>
    </div>
    <a id="example" tabindex="0" class="btn btn-lg btn-danger" role="button" data-bs-toggle="popover" title="Default: Html inside popover">Html inside popover</a>
</section><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
$(document).ready(function () {
    var options = {
        html: true,
        title: "Optional: HELLO(Will overide the default-the inline title)",
        content: $('[data-name="popover-content"]')
    }
    var exampleEl = document.getElementById('example')
    var popover = new bootstrap.Popover(exampleEl, options)
})
</script>

</body>
</html>
Preview