I have the following code:
<ul class="breadcrumbs-wrapper">
<li>Link A (one)</li>
<li>Link A <span style="font-size:10px">(two)</span></li>
<li>Link B</li>
<li>Link C</li>
</ul>
My goal: Eliminating the span within the second li with pure jQuery.
My desired outcome:
<ul class="breadcrumbs-wrapper">
<li>Link A (one)</li>
<li>Link A (two)</li>
<li>Link B</li>
<li>Link C</li>
</ul>
My attempt so far:
var replaced = jQuery(".breadcrumbs-wrapper").html().replace(/<span style="font-size:10px">(two)</span>/g,'(two)');
jQuery(".breadcrumbs-wrapper").html(replaced);
What is wrong here? How do I need to adapt the code?
JSFIDDLE: https://jsfiddle.net/g6b82qya/