Skip to content

Instantly share code, notes, and snippets.

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