"Search"
Bootstrap 4.1.1 Snippet by koshikojha

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script> <body id="myTable"> <div class="container mt-3"> <input class="form-control" id="myInput" type="text" placeholder="Search.."> <br> <h2>Filterable Table</h2> <p>Type something in the input field to search the table for first names, last names or emails:</p> <div>aaa</div> <span>bbb</span> <p>Firstname</p> <p>Lastname</p> <p>Email</p> <p>John</p> <p>Doe</p> <p>john@example.com</p> <p>Mary</p> <p>Moe</p> <p>mary@mail.com</p> <p>July</p> <p>Dooley</p> <p>july@greatstuff.com</p> <p>Anja</p> <p>Ravendale</p> <p>a_r@test.com</p> <p>Note that we start the search in tbody, to prevent filtering the table headers.</p> <p>lorem epsum</p> </div> </body>
$(document).ready(function(){ $("#myInput").on("keyup", function() { var value = $(this).val().toLowerCase(); $("#myTable p,h1,h2,h3,h4,h5,h6,a,span,div,li").filter(function() { $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) }); }); });

Related: See More


Questions / Comments: