Last active
April 4, 2024 22:05
-
-
Save lambdamusic/4734289 to your computer and use it in GitHub Desktop.
JavaScript: Case insensitive jQuery :contains selector #js
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