"Search List"
Bootstrap 3.3.0 Snippet by roestiawan

<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"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Click here for list</button> <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div id="custom-search-input"> <div class="input-group col-md-12"> <input id="search" type="text" class="form-control input-lg" placeholder="Search" /> <span class="input-group-btn"> <button class="btn btn-info btn-lg" type="button"> <i class="glyphicon glyphicon-search"></i> </button> </span> </div> <ul class="list-group"> <li class="list-group-item">Cras justo odio</li> <li class="list-group-item">Dapibus ac facilisis in</li> <li class="list-group-item">Morbi leo risus</li> <li class="list-group-item">Porta ac consectetur ac</li> <li class="list-group-item">Vestibulum at eros</li> </ul> </div> </div> </div> </div> </div> </div>
#custom-search-input{ padding: 3px; border: solid 1px #E4E4E4; border-radius: 6px; background-color: #fff; } #custom-search-input input{ border: 0; box-shadow: none; } #custom-search-input button{ margin: 2px 0 0 0; background: none; box-shadow: none; border: 0; color: #666666; padding: 0 8px 0 10px; border-left: solid 1px #ccc; } #custom-search-input button:hover{ border: 0; box-shadow: none; border-left: solid 1px #ccc; } #custom-search-input .glyphicon-search{ font-size: 23px; }
$(function(){ $('#search').keyup(function(){ var current_query = $('#search').val(); if (current_query !== "") { $(".list-group li").hide(); $(".list-group li").each(function(){ var current_keyword = $(this).text(); if (current_keyword.indexOf(current_query) >=0) { $(this).show(); }; }); } else { $(".list-group li").show(); }; }); });

Related: See More


Questions / Comments: