I am looking for an example or maybe a small hint on the filtering / searching method for a list of elements with several elements entered in a text field.
Suppose I have a list:
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
<li>Water</li>
<li>Juice</li>
</ul>
I want to print (in a text box), for example: Milk; Water; Juice (with a semicolon), which returns three elements.
$('li').filter(function() {
????
})
It can be a filter or another jquery / js function.
in advance for any help
EDIT:
I forgot to say that he should look for part of the last element. For example Coffe; Te → Return Coffe and Tea
source
share