Horje Website
Bs Filters Dropdown Stacked – Bootstrap Filters – Bootstrap Filters – Bootstrap Code

Bs Filters Dropdown Stacked – Bootstrap Filters

Bs Filters Dropdown Stacked - Bootstrap Filters - Bootstrap Filters - Bootstrap Code


 
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1">
  5. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
  6. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  7. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
  8. <style>
  9. /* Style the input field */
  10. #myInput {
  11. padding: 20px;
  12. margin-top: -6px;
  13. border: 0;
  14. border-radius: 0;
  15. background: #f1f1f1;
  16. }
  17. </style>
  18. </head>
  19. <body>
  20. <div class="container">
  21. <h2>Filterable Dropdown</h2>
  22. <p>Open the dropdown menu and type something in the input field to search for dropdown items:</p>
  23. <p>Note that we have styled the input field to fit the dropdown items.</p>
  24. <div class="dropdown">
  25. <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Dropdown Example
  26. <span class="caret"></span></button>
  27. <ul class="dropdown-menu">
  28. <input class="form-control" id="myInput" type="text" placeholder="Search..">
  29. <li><a href="#">HTML</a></li>
  30. <li><a href="#">CSS</a></li>
  31. <li><a href="#">JavaScript</a></li>
  32. <li><a href="#">jQuery</a></li>
  33. <li><a href="#">Bootstrap</a></li>
  34. <li><a href="#">Angular</a></li>
  35. </ul>
  36. </div>
  37. </div>
  38. <script>
  39. $(document).ready(function(){
  40. $("#myInput").on("keyup", function() {
  41. var value = $(this).val().toLowerCase();
  42. $(".dropdown-menu li").filter(function() {
  43. $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
  44. });
  45. });
  46. });
  47. </script>
  48. </body>
  49. </html>



Try Your Self ->



Published:
October 4, 2020
Author:
admin
Category:
Bootstrap 3, Bootstrap Source Code
Views:
16

This article was posted in Bootstrap 3, Bootstrap Source Code and tagged , , . Bookmark the permalink. Follow comments with the RSS feed for this post.Post a Comment or leave a trackback: Trackback URL.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Horje © 2011 - 2022