"Advanced Dropdown Search"
Bootstrap 3.3.0 Snippet by maridlcrmn

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <div class="col-md-12"> <div class="input-group" id="adv-search"> <input type="text" class="form-control" placeholder="Search for snippets" /> <div class="input-group-btn"> <div class="btn-group" role="group"> <div class="dropdown dropdown-lg"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><span class="caret"></span></button> <div class="dropdown-menu dropdown-menu-right" role="menu"> <form class="form-horizontal" role="form"> <div class="form-group"> <label for="filter">Filter by</label> <select class="form-control"> <option value="0" selected>All Snippets</option> <option value="1">Featured</option> <option value="2">Most popular</option> <option value="3">Top rated</option> <option value="4">Most commented</option> </select> </div> <div class="form-group"> <label for="contain">Author</label> <input class="form-control" type="text" /> </div> <div class="form-group"> <label for="contain">Contains the words</label> <input class="form-control" type="text" /> </div> <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> </form> </div> </div> <button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> </div> </div> </div> </div> </div> </div> </div>
body { padding-top: 50px; } .dropdown.dropdown-lg .dropdown-menu { margin-top: -1px; padding: 6px 20px; } .input-group-btn .btn-group { display: flex !important; } .btn-group .btn { border-radius: 0; margin-left: -1px; } .btn-group .btn:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; } .btn-group .form-horizontal .btn[type="submit"] { border-top-left-radius: 4px; border-bottom-left-radius: 4px; } .form-horizontal .form-group { margin-left: 0; margin-right: 0; } .form-group .form-control:last-child { border-top-left-radius: 4px; border-bottom-left-radius: 4px; } @media screen and (min-width: 768px) { #adv-search { width: 500px; margin: 0 auto; } .dropdown.dropdown-lg { position: static !important; } .dropdown.dropdown-lg .dropdown-menu { min-width: 500px; } }

Related: See More


Questions / Comments:

hello community

my dropdown is not working

any help on how to resolve this

Gloriahmutungi () - 3 years ago - Reply 0


hey my dropdown is not working

Gloriahmutungi () - 3 years ago - Reply 0


The drop-down is not working, need help.

======================

[file directory and linking]

1. index.PHP

2. folder_name/given_code.CSS

3. folder_name/bootstrap.min.CSS

4. folder_name/jquery-1.11.1.min.JS

5. folder_name/bootstrap.min.JS

======================

please resolve it or give me your best suggestion. thanks.

kapildev123 (1) - 3 years ago - Reply 0


The drop-down is not working, need help.

[file directory and linking]

(1. index.php) (2. css/given-code.css) (3. css/bootstrap.min.css) (4. js/jquery-1.11.1.min.js) (5. js/bootstrap.min.js)

kapildev123 (1) - 3 years ago - Reply 0


The drop-down is not working, need help.

[file directory and linking]

1. index.php

2. css/givenCSScode.css

3. css/bootstrap.min.css

4. js/jquery-1.11.1.min.js

5. js/bootstrap.min.js

please resolve it or give me your best suggestion. thanks.

kapildev123 (1) - 3 years ago - Reply 0


The drop-down is not working, need help.

======================

[file directory and linking]

1. index.php

2. css/givenCSScode.css

3. css/bootstrap.min.css

4. js/jquery-1.11.1.min.js

5. js/bootstrap.min.js

======================

please resolve it or give me your best suggestion. thanks.

kapildev123 (1) - 3 years ago - Reply 0


The drop-down is not working, need help.

======================

[file directory and linking]

1. index.php

2. css/givenCSScode.css

3. css/bootstrap.min.css

4. js/jquery-1.11.1.min.js

5. js/bootstrap.min.js

======================

please resolve it or give me your best suggestion. thanks.

kapildev123 (1) - 3 years ago - Reply 0


had the similar issues with styles, fixed by upgrading bootstrap to 3.3.0

Linlin Zhu () - 6 years ago - Reply 0


Does anyone else have this problem! How can I fix it?
http://imgur.com/a/jqNqI

imen () - 7 years ago - Reply 0


Problem solved, I missed some lines when I past the css code!

Imen () - 7 years ago - Reply 0


kindly share your code having the same problem

Musharraf () - 7 years ago - Reply 0


I am running into issues getting the input inside a form tag without the dropdown going to the next line. In the example above, I move the open tag from line 11 to after line 4 and the closing tag from line 31 to after line 35. I really like the look of this search but I have to be able to have the main input box within the form tag.

Jon () - 7 years ago - Reply 0


Thanks.
I have fixed this problem when the dropdown inside is clicked and then the search box is hide it.

I had two form tag in HTML document.
I just removed a form tag outside.

Lee Namkyu () - 6 years ago - Reply 1


I am trying to use that in another place, and works ok, BUT, when the dropdown inside (Filter by) is clicked, the filter box is hide it. So that don´t works ok. Anybody knows how to solve that? Or why in other enviroment that works different from here? Thanks

Daniel Silva () - 7 years ago - Reply 0


I solve this, by add jquery. Try it

Arnaldo Roberto J Vicente () - 6 years ago - Reply 0


Hi - I'm facing the same issue. Did you find the solution?

Sourjya Sankar Sen () - 7 years ago - Reply 0


nevermind got it now thanks!

John Doe () - 8 years ago - Reply 0


Hi - could you share with us how you got it to work?

Sourjya Sankar Sen () - 7 years ago - Reply 0


anybody encountered dropdown on advance closing on click. Appreaciate your help. Thanks!

John Doe () - 8 years ago - Reply 0


Hi - I'm facing the same issue. Did you find the solution to this?

Sourjya Sankar Sen () - 7 years ago - Reply -1


Awesome thanks.

Mathieu Hicauber () - 8 years ago - Reply 0


Never mind- its working fine. Didn't have the jquery loaded :)

Timeka Cobb () - 8 years ago - Reply 0


how do you use jquery with this script?

Jon () - 7 years ago - Reply 0


Unfortunalty this snippet isnt working properly for me what do I do? Thank you!

Timeka Cobb () - 8 years ago - Reply 0


Add < !DOCTYPE html> (without space between < and !) on the top of <html> tag to display correctly.

Nan Thanwa () - 8 years ago - Reply 0


I just tried this on an iPhone and the search button drops to a line under the carrot. It looks fine on a desk top. Am I missing something?

Jake S () - 8 years ago - Reply 0


Mateusz Tracz () - 8 years ago - Reply 0


you need to load the extra css.

Martín Gaitán () - 8 years ago - Reply 0


Fair enough, I always thought it's only HTML markup here.

Mateusz Tracz () - 8 years ago - Reply 0


Yeah, plain Bootstrap is not enough in many cases so the CSS from "CSS" tab is necessary.

maxsurguy () - 8 years ago - Reply 0