I have multiple lists on one page (multiple categories of products) like this:
Category 1
- item1<
You can do this with the filter method in jQuery:
var valueToSearch = "item1"; // this one should come from the search box
var allListItems = $("ul > li");
var filteredItems = allListItems.filter(function(index) {
var listItemValue = $(this).text();
var hasText = listItemValue.indexOf(valueToSearch) > -1;
return hasText;
});
Next, you can display the values in the filteredItems variable in a list or something like that, using a for loop.