在特定元素之前和之后查找元素

在特定元素之前和之后查找元素

问题描述:

我有一个列表,其中包含与制表符一起使用的链接.看起来像这样:

I have a list with links I use with tabs. It looks like this:

<ul>
    <li><a href="#">First tab</a></li>
    <li><a href="#">Second tab</a></li>
    <li class="active"><a href="#">Active tab</a></li>
    <li><a href="#">Fourth tab</a></li>
    <li><a href="#">Fifth tab</a></li>
</ul>

如何在活动选项卡之前和之后找到列表元素? (在这种情况下,第二个和第四个标签).

How can I find the list element before and after the active tab? (In this case, the second and fourth tab).

尝试使用find,但没有成功:(

Tried using find, with no success :(

$("li.active").next();

$("li.active").prev();