JSFiddle - React, Tailwind, and code Playground

by Mukul kant

HTML

<h1>This is a demo text</h1>

JavaScript

$(document).ready(function() {
    var words = $('h1').text().split(' ');
    var html = '';
    $.each(words, function() {
        html += '<span style="color:red">'+this.substring(0,1)+'</span>'+this.substring(1) + ' ';
    });
    $('h1').html(html);
});