I recently had the need to find an element on a page based on its text content, but it needed to also be case-insensitive. Finding an element on the page based on its text is easy enough using the jQuery
:contains() selector, but the text passed to this selector must match case, letter for letter.
Instead of modifying the functionality of a core jQuery selector, I created my own custom selector called
:icontains(), where the “i” indicates case-insensitivity. I created a gist for this, shown below.