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');
<div data-text="This is the default text">Test</div>
div:after {
content: attr(data-text);
color: red;
}
$('div').attr('data-text', 'This is some other text');