JSFiddle - React, Tailwind, and code Playground

by Mobeen Sarwar

HTML

<input type="text" id="cautaechipamente" onkeyup="searchech()" placeholder="Search for..." name="search"> 
          <ul id="listsearch" class="list-group">
            <li><a href="#" name="#">Element 1</a></li>
            <li><a href="#" name="#">Element 2</a></li>
            <li><a href="#" name="#">Text 1</a></li>
            <li><a href="#" name="#">Text 2</a></li>
        </ul>

JavaScript

$('li').click(function() {
    $('li').val(this).toggle(); //i tried using instead of .val => .text
    $('li').not(this).hide();
    $(this).find('li').toggle();
});