JSFiddle - React, Tailwind, and code Playground

HTML

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

JavaScript

$(".myclass").contents().filter(function(){ return this.nodeType == 3; }).remove();