JSFiddle - React, Tailwind, and code Playground
by Ronny
HTML
<fieldset id="ex">
<input type="text" id="order" value="" />
</fieldset>
<fieldset id="ex2">
<input type="text" id="order" value="" />
</fieldset>
<fieldset id="ex3">
<input type="text" id="order" value="" />
<div>Fieldset with content</div>
</fieldset>
JavaScript
$('fieldset').each(function(i, fieldset){
if(!$(fieldset).children('div').length) $(fieldset).remove();
});