Skip to content

Instantly share code, notes, and snippets.

@lambdaman2
Created October 1, 2012 12:44
Show Gist options
  • Save lambdaman2/3811450 to your computer and use it in GitHub Desktop.
Save lambdaman2/3811450 to your computer and use it in GitHub Desktop.
JavaScript: Case insensitive jQuery :contains selector
// 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