"Amazon Search"
Bootstrap 3.3.0 Snippet by Crash16

<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-fluid"> <div class="row"> <div class="col-xs-8 col-xs-offset-2"> <div class="input-group"> <div class="input-group-btn search-panel"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <span id="search_concept">All</span> <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu"> <li><a href="#contains">Example 1</a></li> <li><a href="#its_equal">Example 2</a></li> <li><a href="#greather_than">Example 3</a></li> <li><a href="#less_than">Example 4</a></li> <li class="divider"></li> <li><a href="#all">All</a></li> </ul> </div> <input type="hidden" name="search_param" value="all" id="search_param"> <input type="text" class="form-control" name="x" placeholder="Search"> <span class="input-group-btn"> <button class="btn btn-default" type="button"><span class="glyphicon glyphicon-search"></span></button> </span> </div> </div> </div> </div>
body{ margin-top:60px; }
$(document).ready(function(e){ $('.search-panel .dropdown-menu').find('a').click(function(e) { e.preventDefault(); var param = $(this).attr("href").replace("#",""); var concept = $(this).text(); $('.search-panel span#search_concept').text(concept); $('.input-group #search_param').val(param); }); });

Related: See More


Questions / Comments:

Great looking search bar.. Has anyone actually added the amazon search script to it? I have it in a conventional <form but,="" never="" seen="" it="" with="" bootstrap.="" any="" examples?="" thanks="">

Ronald Larrea () - 8 years ago - Reply 0