Skip to content

Instantly share code, notes, and snippets.

View pklauzinski's full-sized avatar

Philip Klauzinski pklauzinski

View GitHub Profile
@pklauzinski
pklauzinski / jquery.icontains.js
Created June 24, 2015 20:08
Custom jQuery :icontains selector for finding element based on text in a page, case-insensitive
/**
* Example use:
* $('div:icontains("Text in page")');
* Will return jQuery object containing any/all of the following:
* <div>text in page</div>
* <div>TEXT in PAGE</div>
* <div>Text in page</div>
*/
$.expr[':'].icontains = $.expr.createPseudo(function(text) {
return function(e) {