"Combined Search Bar"
Bootstrap 3.1.0 Snippet by escapedlion

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.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"> <!DOCTYPE html> <html lang="en"> <head> <title>Support</title> <!-- Force IE to turn off past version compatibility mode and use current version mode --> <meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1"> <!-- Get the width of the users display--> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Text encoded as UTF-8 --> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- icons --> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet"> <!-- bootstrap --> <link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" id="default"> <!-- theme --> <link href="https://netdna.bootstrapcdn.com/bootswatch/3.0.3/bootstrap/bootstrap.min.css" rel="stylesheet" title="theme"> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries in IE8, IE9 --> <!--[if lt IE 9]> <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.3.0/respond.js"></script> <![endif]--> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries in IE8, IE9 --> <!--[if lt IE 9]> <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.3.0/respond.js"></script> <![endif]--> </head> <body class="bootstrap"> <section id="wrapper"> <div class="row"> <div class="col-md-12"> <div class="container"> <form action="clientsearch/index.asp" method="post" class="navbar-form" name="search-form" id="search-form" accept-charset="utf-8"> <div class="form-group" style="display:inline;"> <div class="input-group"> <span class="input-group-btn btn-block" > <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"> <span class="glyphicon glyphicon-search"></span> <span class="nav-label"> Search</span> <span class="fa fa-caret-down"></span> </button> <ul id="search-option" class="dropdown-menu pull-left" role="menu"> <li> <a href="#" data-searchtype="search-user" data-placeholder="Enter First or Last Name"> <span class="glyphicon glyphicon-user"></span> <span class="nav-label">User</span> </a> </li> <li> <a href="#" data-searchtype="search-org" data-placeholder="Enter Organization Name"> <span class="fa fa-building-o"></span> <span class="nav-label">Organization</span> </a> </li> <li> <a href="#" data-searchtype="search-kb" data-placeholder="Enter Knowledgebase Search Terms"> <span class="fa fa-book"></span> <span class="nav-label">KnowledgeBase</span> </a> </li> <li> <a href="#" data-searchtype="search-venue" data-placeholder="Enter Venue Search Terms"> <span class="fa fa-map-marker"></span> <span class="nav-label">Venue</span> </a> </li> <li> <a href="#" data-searchtype="search-pl" data-placeholder="Enter Private Label"> <span class="fa fa-ticket"></span> <span class="nav-label">Private Label</span> </a> </li> </ul> </span> <div class="input-group col-lg-12 center-block"> <input class="form-control" id="search-input" class="search-input" type="text" placeholder="blank placeholder"> </div> <div class="input-group-btn navbar-btn"> <button class="btn btn-default btn-nav"> GO </button> </div> </div> </div> </form> <br> <h5>Combined Search Bar</h5> <div> Search Type: <span id="displayText">text</span></div> <div>Search Icon: <span id="displayHTML">html</span></div> <div>Search ID: <span id="displayData">text</span></div> <div>Placeholder Text: <div id="displayPlace">text</span></div> <br> </div> </div> </div> </section> </body> </html> </div>
$(".input-group-btn .dropdown-menu li a").click(function() { var selText = $(this).text(); var selHTML = $(this).html(); var selSearch = $(this).data("searchtype"); var selPlace = $(this).data("placeholder"); $(this).parents('.input-group-btn').find('.dropdown-toggle').html(selHTML+'<span class="caret"></span>'); $("#displayText").text(selText); $("#displayHTML").html(selHTML); $("#displayData").text(selSearch); $("#displayPlace").text(selPlace); $("#search-input").attr("placeholder", selPlace); });

Related: See More


Questions / Comments: