Return to Snippet

Revision: 32194
at September 21, 2010 02:11 by magicrebirth


Initial Code
// For jQuery 1.2

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


// 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;
};

Initial URL
http://stackoverflow.com/questions/187537/is-there-a-case-insensitive-jquery-contains-selector

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

Initial Title
Case insensitive jQuery :contains selector

Initial Tags
jquery, text

Initial Language
JavaScript