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 61439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:19:09+00:00 2026-05-10T18:19:09+00:00

Is there a case insensitive version of the :contains jQuery selector or should I

  • 0

Is there a case insensitive version of the :contains jQuery selector or should I do the work manually by looping over all elements and comparing their .text() to my string?

  • 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. 2026-05-10T18:19:10+00:00Added an answer on May 10, 2026 at 6:19 pm

    What I ended up doing for jQuery 1.2 is :

    jQuery.extend(     jQuery.expr[':'], {          Contains : 'jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0'  }); 

    This will extend jquery to have a :Contains selector that is case insensitive, the :contains selector remains unchanged.

    Edit: For jQuery 1.3 (thanks @user95227) and later you need

    jQuery.expr[':'].Contains = function(a,i,m){      return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0; }; 

    Edit: Apparently accessing the DOM directly by using

    (a.textContent || a.innerText || '')  

    instead of

    jQuery(a).text() 

    In the previous expression speeds it up considerably so try at your own risk if speed is an issue. (see @John ‘s question)

    Latest edit: For jQuery 1.8 it should be:

    jQuery.expr[':'].Contains = jQuery.expr.createPseudo(function(arg) {     return function( elem ) {         return jQuery(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;     }; }); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a solution to have a case-insensitive version of the :contains selector
I want the contains() method from ArrayList to be case insensitive. Is there any
Is the indexOf(String) method case sensitive? If so, is there a case insensitive version
We all know there are some case sensitive languages, as well as case insensitive.
In C# there is a a problem: there is no case insensitive String.Contains method
Is there a case-insensitive variant of the Bob Jenkins hash function? Generics.Defaults.BobJenkinsHash provides a
I want to achieve case insensitive uniqueness in a varchar column. But, there is
is there a way to force the login to be case insensitive using acegi
Is there a syntactically cleaner way to preform a case insensitive string comparison in
In MSVC++, there's a function strcmpi for case-insensitive C-string comparisons. When you try and

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.