JSFiddle - React, Tailwind, and code Playground

by ttkaminski

HTML

<script src="http://getfirebug.com/firebug-lite-debug.js"></script>
<div>aWeSome tExt</div>
<div>aWeSome tExt</div>
<div>aWeSome tExt</div>
<div>aWeSome tExt</div>
<div>aWeSome tExt</div>

JavaScript

// An implementation of a case-insensitive contains pseudo
// made for all versions of jQuery
(function( $ ) {

function icontains( elem, text ) {
    return (
        elem.textContent ||
        elem.innerText ||
        $( elem ).text() ||
        ""
    ).toLowerCase().indexOf( (text || "").toLowerCase() ) > -1;
}

$.expr[':'].icontains = 
    function( elem, i, match ) {
        console.log("index=" + i);
        return icontains( elem, match[3] );
    };

})( jQuery );

console.log( jQuery("div:icontains(aWeSome tExt)").length );