JSFiddle - React, Tailwind, and code Playground
by kneidels
HTML
<div id="id1">
<p>
apple
</p>
<p>
ball
</p>
<p>
cat
</p>
<p>
dogsss
</p>
</div>
JavaScript
$('#id1 p').each(function() {
// get element text
var text = $(this).html();
// modify text
text = text.replace('dog', 'doll');
// update element text
$(this).html(text);
});