JSFiddle - React, Tailwind, and code Playground

by Robert N.

HTML

<label>Type "abc": <input type="text" id="search" /></label>
<ul>
  <li>a</li>
  <li>b</li>
  <li>c</li>
  <li>ab</li>
  <li>bc</li>
  <li>ac</li>
  <li>abc</li>
</ul>

JavaScript

(function($) {
  $('#search').on('keyup', function() {
    var needle = $(this).val();
    $('li').hide();
    $('li').each(function() {
      if ($(this).html().indexOf(needle) != -1) {
        $(this).show();
      }
    });
  });
})(jQuery);