Skip to content

Instantly share code, notes, and snippets.

@stefanocudini
Created April 26, 2012 21:58
Show Gist options
  • Select an option

  • Save stefanocudini/2503523 to your computer and use it in GitHub Desktop.

Select an option

Save stefanocudini/2503523 to your computer and use it in GitHub Desktop.
jquery :contains() case insensitive selector
$.extend($.expr[':'], { //definizione di :conaints() case insesitive
'containsi': function(elem, i, match, array)
{
return (elem.textContent || elem.innerText || '').toLowerCase()
.indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
//example
$("a:containsi('text')");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment