Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:12:30+00:00 2026-06-05T15:12:30+00:00

Trying to make this jQuery filter that uses .find case-insensitive. For example, when the

  • 0

Trying to make this jQuery filter that uses .find case-insensitive.

For example, when the search = “cat” (no quotes) it will find “cat” but not “Cat” or “CAT”. Similarly, “Cat” finds “Cat” but not “cat”.

I suspect it’s something very basic but cannot figure it out so I’m reaching out here with my first post.

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

Thanks in advance for your help!

PS Please no catcalls for something probably pretty junior for you guys. 😉

  $("#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) > 0) {
            $li.show();
          } else {
            $li.hide();
          }
        }
      }
    });
 }); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:12:31+00:00Added an answer on June 5, 2026 at 3:12 pm

    you want to make case insensitive searches. try using regex search(/string/i)

    $("#filter").live("keyup", function (ev) {
        var $filter = $(this),
            keyCode = ev.keyCode || ev.which,
            search;
    
        if (keyCode === 27) { //ESC
          $filter.val("");
        }
    
        search = $(this).val() ;
        // added
        var search_regex = new RegExp(search, 'i');
        $("#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 {
              // changed here
              if (search_regex.test($li.text())) {
                $li.show();
              } else {
                $li.hide();
              }
            }
          }
        });
     }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to make this to be a little jQuery plugin that
I am trying to make this jquery carousel work with different widths. Right now
I am trying to make two ajax requests in parallel using jQuery like this:
I'm trying to make Jeditable works on new elements created using this jquery file
I'm trying to make a search of some items with a jquery ui autocomple
Tools: Visual Studio 2010 I'm trying to learn jQuery, but I cant make this
Im trying to make this dynamic email input field which uses autocomplete on a
I'm trying to install a jquery plugin but i cannot make it work. This
I'm trying to make this jquery plugin => http://leandrovieira.com/projects/jquery/lightbox/ work with multiple galleries on
I'm trying to make this jquery drop down bar be on top at all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.