JSFiddle - React, Tailwind, and code Playground
by pleinx
HTML
<div class="main color-1">1</div>
<div class="main color-2">2</div>
<div class="main color-3">3</div>
CSS
.color-1 {
background: blue;
}
.color-2 {
background: yellow;
}
.color-3 {
background: green;
}
JavaScript
// example to select all prefixes
$("div[class*=' color-']").css('font-size', '24px');
setTimeout(function() {
// example remove classes by wildcard
$('.main').removeClass (function (index, className) {
return (className.match (/(^|\s)color-\S+/g) || []).join(' ');
});
}, 1000);