JSFiddle - React, Tailwind, and code Playground
by tuga
HTML
<input type="text" id="searchcity">
<div id="citysname">
<a href="#" id="place" class="kathmandu">Kathmandu</a>
<a href="#" id="place" class="bhaktapur">bhaktapur</a>
<a href="#" id="place" class="Narayangarh">Narayangarh</a>
<a href="#" id="place" class="lalitpur">lalitpur</a>
<a href="#" id="place" class="something">something</a>
<a href="#" id="place" class="hello">hello</a>
</div>
JavaScript
$(document).ready(function(){
$(document).on("keyup", "#searchcity", function(){
var city = $(this).val();
$( "#citysname a" ).each(function() {
$(this).not('[class^='+ city +']').hide();
$(this+'[class^='+ city +']').show();
});
});
});