I want to change text that appears before a span with JQuery, this text will change when a user renames a folder.
<li>
<a href="#">
Pasta 1
<span class="tag tag-pill tag-danger" id="spanPasta1">0</span>
</a>
</li>
When I change using the code below, the span is deleted.
$("#spanPasta1").closest('a').text('pasta 2')
I want to change the text, without having to change all the CSS code and take the span from within the href.