JSFiddle - React, Tailwind, and code Playground

HTML

<div>Testing before
    <p>Some more text inside p</p>
    between
    <p>asdasdasdasdasde p</p>
    Test after
</div>

JavaScript

var x = $('div').contents()
    .filter(function(){return this.nodeType === 3}).wrap('<b />');
console.log(x);