Need help to make jQuery .find case insensitive
<p>Trying to make this jQuery filter that uses .find case-insensitive.</p>

<p>For example, when the search = "cat" (no quotes) it will find "cat" but not "Cat" or "CAT". Similarly, "Cat" finds "Cat" but not "cat".</p>

<p>I suspect it's something very basic but cannot figure it out so I'm reaching out here with my first post.</p>

<p>I have no control over the contents of the list items themselves so cannot modify anything there,</p>

<p>Thanks in advance for your help!</p>

<p>PS Please no catcalls for something probably pretty junior for you guys. ;)</p>

<pre><code>  $("#filter").live("keyup", function (ev) {
    var $filter = $(this),
        keyCode = ev.keyCode || ev.which,
        search;

    if (keyCode === 27) { //ESC
      $filter.val("");
    }

    search = $(this).val();
    $("#results").find("li").each(function () {
      var $li = $(this);
      if (search === "") {
        $li.show();
      } else {
        if (_.include(service_names, search)) {
          $li.toggle($li.hasClass("items-" + search));
        } else {
          if ($li.text().search(search) &gt; 0) {
            $li.show();
          } else {
            $li.hide();
          }
        }
      }
    });
 }); 
</code></pre>
