JSFiddle - React, Tailwind, and code Playground

by ArchersFiddle

HTML

<div class="example" title=" $ ">Something in the div</div>

<br /><br />

<button id="change-before">change before</button>

CSS

.example:before {
    content: attr(title);
    margin-left: 4px;
    color: #666;
}

JavaScript

$("#change-before").on("click", function() {
    $(".example").attr("title", " £ ");
});