JSFiddle - React, Tailwind, and code Playground

by Vipin Patil

HTML

<div id="faq">
    <p><label>Search</label><br />
<input id="search" value="" size="30" /></p>
<p>&nbsp;</p>
<ul id="result">
  <li><strong>How round is the Earth?</strong><br /><br /><em>
  Very round.
  <br /><br /></em></li>
  <li><strong>How rectangular is paper?</strong><br /><br /><em>
  Very rectangular.
  <br /><br /></em></li>
</ul>
</div><!-- #faq -->

CSS

#faq EM {
display:none;
}

#faq LI STRONG {
font-weight:normal;
color:#246;
text-decoration:underline;
cursor:pointer;
}

JavaScript

$(document).ready(function() {
    $('LI STRONG').click(function(e) {
        e.preventDefault(); // disable text selection
        $(this).parent().find('EM').slideToggle();
        return false; // disable text selection
    });

    $('#search').keyup(function(e) {
        var s = $(this).val().trim();
        if (s === '') {
            $('#result LI').show();
            return true;
        }
        $('#result LI:not(:contains(' + s + '))').hide();
        $('#result LI:contains(' + s + ')').show();
        return true;
    });

}); // end document ready