JSFiddle - React, Tailwind, and code Playground

HTML

<div id="text"><span class="green">Das ist</span> der Mustertext mit vielen wörtern .....</div>

CSS

.green {
    color:green;
}

JavaScript

function color_text() {
    var a = $('#text').html();
    a = a.replace('<span class="green">', '');
    a = a.replace('</span> ', ' <span class="green">');
    var b = $('#text').html().split('</span>');
    if (!b[1]) return 0;
    b = b[1].split(' ');
    a = a.replace(b[2], b[2] + '</span>');
    $('#text').html(a);
    setTimeout(color_text, 1000);
}
setTimeout(color_text, 1000);