Skip to content

Instantly share code, notes, and snippets.

@dennysfredericci
Created July 22, 2014 18:19
Show Gist options
  • Save dennysfredericci/ca99b08648649b545dfd to your computer and use it in GitHub Desktop.
Save dennysfredericci/ca99b08648649b545dfd to your computer and use it in GitHub Desktop.
A simple jquery code to search a text inside of li tag
//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();
}
});
});
@rahulcs754
Copy link

thanks for this

@pranav-ted
Copy link

thanks

@Awad2002
Copy link

Awad2002 commented Nov 9, 2021

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment