JSFiddle - React, Tailwind, and code Playground
HTML
<p id="text1" class="changeme">
Before Change
</p>
<p id="text2" class="changeme">
Before Change
</p>
<p id="text3" class="changeme">
Before Change
</p>
JavaScript
const textValues = {
"text1": "text1 new text",
"text2": "text2 new text",
"text3": "text3 new text",
}
window.addEventListener('load', () => {
var texts = Array.from(document.getElementsByClassName("changeme"));
texts.forEach(text => {
text.innerHTML = textValues[text.id];
});
});