JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#" name="usernameMenu" class="dropdown-toggle" data-toggle="dropdown" role="button">
<span class="glyphicon glyphicon-user"></span>
<span class="caret"></span>
</a>
<br>
<button id="remove">remove text</button>
JavaScript
$("#remove").on("click", function () {
$('a[name="usernameMenu"]').find('span')[0].nextSibling.remove();
});
$('a[name="usernameMenu"] span:eq(0)').after("add text here");