Skip to content

Instantly share code, notes, and snippets.

@JiLiZART
Created May 13, 2013 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JiLiZART/5570501 to your computer and use it in GitHub Desktop.
Save JiLiZART/5570501 to your computer and use it in GitHub Desktop.
jQuery Contains Expression, checks if element contain a value

Code

  jQuery.expr[':'].contains = function(a,i,m){
      return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
  };
  

Usage

$('a:contains(Planked Chars)').css('color', '#ccc');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment