Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.71 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  5. <script>
  6. $(document).ready(function(){
  7.     $("#myButton").on("click", function() {
  8.         var value = $(this).val().toLowerCase();
  9.         $("#myDIV *").filter(function() {
  10.             $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
  11.         });
  12.     });
  13. });
  14. </script>
  15. </head>
  16. <body>
  17.  
  18. <h2>Filter Anything</h2>
  19. <p>Type something in the input field to search for a specific text inside the div element with id="myDIV":</p>
  20. <input id="myButton" type="button" value="Public Safety">
  21.  
  22. <div id="myDIV">
  23. <li>Test 1</li>
  24. <li>Girl Please</li>
  25. <li>YO YO YO YO</li>
  26. <li>Public Safety</li>
  27. </div>
  28.  
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement