jQuery selector to target any CSS name (of multiple present) starting with a prefix?
- by John K
I'm considering one selection statement that would target one of many css class names in a single class attribute value based on a string prefix.
For example, I want any detail- prefixed class names to get targeted from the following sample links.
<a href="eg.html" class="detail-1 pinkify another">
<a href="eg.html" class="something detail-55 minded">
<a href="eg.html" class="swing narrow detail-Z">
<a href="eg.html" class="swing narrow detail-Z detail-88 detail-A">
It's reminiscent of how [class|="detail"] prefix selector works on a scalar attribute value, and also of .hasClass(className), but my question needs both concepts applied simultaneously.
Note: The detail- prefix won't necessarily be the first class name of the bunch.