JSFiddle - React, Tailwind, and code Playground

by manishie

HTML

<section class="main">
	 <form class="search" method="post" action="index.html" id="searchform">
		 <input type="text" name="q" placeholder="Search..." id="searchbox" />

		 <ul class="results">
			 <li ><a href="#">A<br /><span>Description...</span></a></li>
			 <li><a href="#">B<br /><span>Description...</span></a></li>
	 		<li><a href="#">C<br /><span>Description...</span></a></li>
         	<li><a href="#">D<br /><span>Description...</span></a></li>
		 </ul>
		 		 
	 </form>
</section>

JavaScript

$("#searchbox").keyup(function()
	{
			$("li" ).each(function( index ) {
			if ($(this).text().indexOf($("#searchbox").val()) > -1)
			{
				$(this).show();
			}
	}); 
	$("li span").click(function(){console.log('yhere');
		alert("HI");
		alert($(this).text());
		return false;
	});
});