JSFiddle - React, Tailwind, and code Playground
HTML
<ul>
<li><span id="replaceWithEmptyString">not replaced by empty string</span></li>
<li><span id="replaceWithEmptyFunction">not replaced by function returning empty string</span></li>
</ul>
<div id="append"></div>
JavaScript
jQuery("#replaceWithEmptyString").replaceWith("");
jQuery("#replaceWithEmptyFunction").replaceWith( function() { return ""; } );
var $div = jQuery("<div></div>").appendTo("body").append("");
$div.html( "Child nodes after <code>.append(\"\")</code>: " + $div[0].childNodes.length );