This function is built into the Dom utility. It natively uses the getElementsBy method. With it you can get any element by its className.
getElementsBy
class="foo bar"
class="foo"
rel="search cool"
rel="search"
rel="searchesk"
Found