Imagine this scenario:
<span>Item 1</span> | <span>Item 2</span>
How can I target the | and remove it? Also, assume I always need to remove the | before the span with "Item 2" in it, and the list can grow with items being added before OR after "Item 2." All new items will be enclosed within span and they'll be separated by |.
$('span').each(function() {
if ($(this).text() == 'Item 2') {
$(this.previousSibling).remove();
}
});
http://jsfiddle.net/spFUG/2/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With