JSFiddle - React, Tailwind, and code Playground

by mowglisanu

HTML

<div id="foo"><span class="bar"><em>hello</em><br></span>world</div>

JavaScript

var foo = $("#foo").clone();
foo.find("br").replaceWith(" ");
console.log(foo.text());