JSFiddle - React, Tailwind, and code Playground

by simevidas

HTML

<ul>
    <li class="but"><a href="#">ONE WORD <small>Other words here</small></a></li>
    <li class="but"><a href="#">ONE WORD <small>Other words here</small></a></li>
    <li class="but"><a href="#">ONE WORD <small>Other words here</small></a></li>
    <li class="but"><a href="#">ONE WORD <small>Other words here</small></a></li>
</ul>

CSS

span { color:red }

JavaScript

$('li.but > a').html(function(i, v) {
    return v.replace(/\s(.*?)\s/, ' <span>$1</span> ');
});