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
Is the indexOf(String) method case sensitive? If so, is there a case insensitive version
Nearly every kind of lookup in Django has a case-insensitive version, EXCEPT in, it
Is there exist a case-insensitive find() method for std::string ?
Is there a way to do case insensitive replace on a string without using
Is there any Collation type in MySQL which supports Case Sensitive. I had all
I think in this case there is no need to declare a public constructor
I'm considering rolling my own, but just in case there's a good piece of
In java, is there ever a case for allowing a non-abstract class to be
Are there instances where switch(case) is is a good design choice (except for simplicity)

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.