JSFiddle - React, Tailwind, and code Playground
HTML
<ul class="friend_list">
<li>
<a href="#">Krishna</a>
<a href="#">Karan</a>
<a href="#">Ram</a>
<a href="#">Hari</a>
</li>
</ul>
<input type="text" name="sort" value="Search" id="sort">
JavaScript
$("#sort").keyup(function(){
var v = $(this).val();
if(v.length==0)
{ $("a").show();}
else
{
$("a").each(function(){
if($(this).text().indexOf(v)==0)
$(this).show();
else
$(this).hide();
})
}
}) ;