JSFiddle - React, Tailwind, and code Playground

HTML

<div class="hello"> 
           <p>
       <a href=#1>Don't hide me</a>   
           </p>  
    
</div>
<div class="hello">
           
   <p> <a href=#2>I will be hidden</a></p>
</div>

<div class= 'hello'>  
    <p><a href=#3>number 3</a></p>
</div>

<div id=1 class='content'>
<p>
hi
</p>
</div>

<div id=2 class='content'>
<p>

</p>
</div>

<div id=3 class='content'>
<p>

</p>
</div>

JavaScript

$('.content').each(function() {
    if($(this) === '' || $(this).text() === '') {
        $(this.id).find('[href="+#id+”]').hide();
    }
});