JSFiddle - React, Tailwind, and code Playground

by Valder Black

HTML

<div id="content">
<b><i></i>g</b>
</div>
<br><textarea id="txt"></textarea>

JavaScript

$('#content *').each(function() {
  var a = $(this).html().replace(/\s*/gim, '');
  
  var b = $(this)[0].tagName;
  if(a == "") {alert("Tag <" + b + "></" + b + "> is EMPTY"); $(this).remove();}
});
$('#txt').val($('#content').html())