JSFiddle - React, Tailwind, and code Playground

HTML

<div data-text="This is the default text">Test</div>

CSS

div:after {
    content: attr(data-text);
    color: red;
}

JavaScript

$('div').attr('data-text', 'This is some other text');