JSFiddle - React, Tailwind, and code Playground

HTML

<ul>
    <li>
    </li>
</ul>

<p>Test</p>

<textarea>Sample</textarea>

JavaScript

$(document).ready(function(){
    
    $('*').each(function(){ // For each element
        if( $(this).text().trim() === '' )
            $(this).remove(); // is it is empty, it removes it
    });
    
});