-
-
Save Gorpetrosov/a0df8b65bdafc88a2d3edd2268e827b2 to your computer and use it in GitHub Desktop.
A simple jquery code to search a text inside of li tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //searchText is a input type text | |
| $('#searchText').bind('keyup', function() { | |
| var searchString = $(this).val(); | |
| $("ul li").each(function(index, value) { | |
| currentName = $(value).text() | |
| if( currentName.toUpperCase().indexOf(searchString.toUpperCase()) > -1) { | |
| $(value).show(); | |
| } else { | |
| $(value).hide(); | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment