content logo

Bootstrap Search Boxes:

Bootstrap Search Bar with Drop Down Select

Seamless user experience is the ultimate goal of every website. If you want your website to become successful and lucrative, then you have to make sure your visitors are satisfied with what you have going on in your site and ensure a steady convert rate. To achieve such goal, you need to implement a couple of important features such as sidebars, tabs, grids, tables, etc. However, according to statistics, one of these features is more important than the rest and plays such a vital role that websites cannot succeed without it. this important element is the search function. Adding this element to your site is necessary as it allows the visitors to look for what they need in your site much quicker and with more ease.

In today’s post, we are sharing a Bootstrap search box to help improve your website and to process the searches. Also, for more advanced searches, this Bootstrap search field offers a filter option. the filters can be accessed via a search drop down select menu besides the search button. Unfortunately, the search box with filter option is not as thorough and only feature two options. You can either search by organization or based on individuals. With this element added, you can ensure a well ranked website.

#

Bootstrap Search Box

#

Search Box with Filter

#

Search Drop Down Select

#

Bootstrap Search Field

<!-- This script got from frontendfreecode.com -->
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <nav class="center">
                <div >
                    <form role="search">
                        <div class="input-group">
                            <input type="text" class="form-control" />
                            <div class="input-group-btn">
                                <button type="button" class="btn btn-search btn-danger">
                                    <span class="glyphicon glyphicon-search"></span>
                                    <span class="label-icon">Search</span>
                                </button>
                                <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
                                    <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu pull-right" role="menu">
                                    <li>
                                        <a href="#">
                                            <span class="glyphicon glyphicon-user"></span>
                                            <span class="label-icon">Search By User</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="#">
                                            <span class="glyphicon glyphicon-book"></span>
                                            <span class="label-icon">Search By Organization</span>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </form>
                </div>
            </nav>
        </div>
    </div>
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
body{
    margin-top:20px;
}
.navbar .navbar-search .dropdown-menu {
    min-width: 25px;
}
.dropdown-menu .label-icon {
    margin-left: 5px;
}
.btn-outline {
    background-color: transparent;
    color: inherit;
    transition: all 0.5s;
}
.center {
    max-width: 600px;
    margin: auto;
}
$(function () {
    $(".input-group-btn .dropdown-menu li a").click(function () {
        var selText = $(this).html();
        //$('.btn:first-child').html(selText+'<span class="caret"></span>');
        $(this).parents(".input-group-btn").find(".btn-search").html(selText);
    });
});
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<style>
body{
    margin-top:20px;
}
.navbar .navbar-search .dropdown-menu {
    min-width: 25px;
}
.dropdown-menu .label-icon {
    margin-left: 5px;
}
.btn-outline {
    background-color: transparent;
    color: inherit;
    transition: all 0.5s;
}
.center {
    max-width: 600px;
    margin: auto;
}
</style>

</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <nav class="center">
                <div >
                    <form role="search">
                        <div class="input-group">
                            <input type="text" class="form-control" />
                            <div class="input-group-btn">
                                <button type="button" class="btn btn-search btn-danger">
                                    <span class="glyphicon glyphicon-search"></span>
                                    <span class="label-icon">Search</span>
                                </button>
                                <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
                                    <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu pull-right" role="menu">
                                    <li>
                                        <a href="#">
                                            <span class="glyphicon glyphicon-user"></span>
                                            <span class="label-icon">Search By User</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="#">
                                            <span class="glyphicon glyphicon-book"></span>
                                            <span class="label-icon">Search By Organization</span>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </form>
                </div>
            </nav>
        </div>
    </div>
</div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
$(function () {
    $(".input-group-btn .dropdown-menu li a").click(function () {
        var selText = $(this).html();
        //$('.btn:first-child').html(selText+'<span class="caret"></span>');
        $(this).parents(".input-group-btn").find(".btn-search").html(selText);
    });
});
</script>

</body>
</html>
Preview