JSFiddle - React, Tailwind, and code Playground

HTML

<table class='grid'>grid</table>
<table class='Grid'>Grid</table>

<button class='btn-case-sensitive'>case sensitive</button>
<button class='btn-case-insensitive'>case insensitive</button>

JavaScript

$.fn.filterByClass = function (classname) {
    return $(this).filter(function(){
       return (" "+$(this).get(0).className.toLowerCase()+" ".indexOf(' '+classname.toLowerCase()+' ')!=-1);
    });
};

$('.btn-case-insensitive').click(function(){

alert($('table').filterByClass('grid').length+' tables match');

})

$('.btn-case-sensitive').click(function(){
   alert($('table.grid').length+' tables match');

})