JSFiddle - React, Tailwind, and code Playground

HTML

<button id="b1">Clear</button>
<div>
<span>,Span1</span>|<span>Span1</span>|<span>Span1</span>|<span>Span1</span>
</div>

JavaScript

$(document).ready(function(){
    $('#b1').click(function(){
        $('span:first-child').parent().html($('span:first-child').parent().html().replace(/\|/g, ''))
    });
});