JSFiddle - React, Tailwind, and code Playground

by Nicolas PUJOL

HTML

<blockquote>abc def ghi jkl mno pqr stu vwx yz</blockquote>

JavaScript

var colors = ['red', 'blue', 'green', 'pink', 'black'];
$('blockquote').each(function () {
    var newText = "";
    $(this).html($(this).text().split(' ').map(function (v) {
        newText += encodeURIComponent('<span style="color:' + colors[Math.floor(Math.random() * colors.length)] + '">' + v + '</span> ');
    }));
    $(this).html(newText);
});