Created
October 1, 2012 12:44
-
-
Save lambdaman2/3811450 to your computer and use it in GitHub Desktop.
JavaScript: Case insensitive jQuery :contains selector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment