JSFiddle - React, Tailwind, and code Playground
by dimitrios_87
HTML
<a href="link.html">Some text <img src="image.jpg" /></a>
JavaScript
var text = $('a').contents().first()[0].textContent;
$('a').contents().first()[0].textContent = text.replace("Some text", "Other text");