Javascript删除最后一次出现

ngp*_*und 0 javascript jquery

<div class="breadcrumbs">
    <a title="Go to Page." href="http://www.domain.com/dev" class="home">Home Page</a> &gt; <a title="Go to the News category archives." href="http://www.domain.com/dev"/topics/news/" class="taxonomy category">News</a> &gt; <span>News</span>
</div>
Run Code Online (Sandbox Code Playgroud)

在上面的例子中有2个分隔符,我使用以下内容jQuery('.breadcrumbs .category').remove();删除了新闻的链接,但这让我失望

<div class="breadcrumbs">
    <a title="Go to Page." href="http://www.domain.com/dev" class="home">Home Page</a> &gt; &gt; <span>News</span>
</div>
Run Code Online (Sandbox Code Playgroud)

什么是删除其中一个的最佳方法&gt;

Dav*_*mas 5

不要担心删除最后一次出现,使用css将(表示)>放在正确的位置:

.breadcrumbs a + a::before {
    content: '>';
}
Run Code Online (Sandbox Code Playgroud)

或者,因为当前页面是span您可能更喜欢的:

.breadcrumbs a::after {
    content: '>';
}
Run Code Online (Sandbox Code Playgroud)