JSFiddle - React, Tailwind, and code Playground

HTML

<div>This is some content.  <b>Other HTML should not be affected by manipulations</b></div>

CSS

span { color: red; font-weight: bold; }

JavaScript

$.fn.wrapStart = function (numWords) { 
    var node = this.contents().filter(function () { return this.nodeType == 3 }).first(),
        text = node.text(),
        first = text.split(" ", numWords).join(" ");

    if (!node.length)
        return;
    
    node[0].nodeValue = text.slice(first.length);
    node.before('<span>' + first + '</span><br/>');
};

$("div").wrapStart(3);