jquery-has-class-like

Select elements by testing each of an element's classes for `pattern`.

Usage no npm install needed!

<script type="module">
  import jqueryHasClassLike from 'https://cdn.skypack.dev/jquery-has-class-like';
</script>

README

hasClassLike

Select elements by testing each of an element's classes for pattern.

Example

<div class="foobar foobaz"></div>

Find all elements that have a class that ends in "bar".

$("[class$=bar]").length // 0 because "foobar" is not at the end of the `class` attribute.
$("*").hasClassLike(/bar$/).length // 1