JSFiddle - React, Tailwind, and code Playground

HTML

<div id="target">
    foo / bar; baz<img src="/image.png">
</div>

JavaScript

var textNode = $("#target").contents().first();
    var parts = textNode.text().split(/\s/);
    var replaceWith = "";
    for (var i =0; i < parts.length;i++) {
        replaceWith += "<a href='http://www.google.com'>"  + parts[i] + "</a> ";
    }
    textNode.replaceWith(replaceWith);