JSFiddle - React, Tailwind, and code Playground

HTML

<div class="myclass"> 
    <a href="#"></a>
    <a href="#"></a>
    Hey I want to delete this text
</div>

JavaScript

$(document).ready(function () {
    $('.myclass').each(function () {
        // Confused here
        $(this).contents().filter(function () {
            return this.nodeType === 3 && $.trim(this.nodeValue).length;
        }).replaceWith('');
    });
});