如何使用 jquery 查找 "this" 元素的下一个 "p" 兄弟?

How to find next "p" sibling of "this" element using jquery?

我们知道我们可以使用以下语法来 select 下一个元素。

$("div + p")

每个 <div> 个元素旁边的 select 个 <p> 个元素。 我想 select 下一个元素使用它。 例如 我试过了

$("this + p") or
$(this + p")

但是没有用。谁能告诉我正确的语法。

您可以使用 .next() select 元素的下一个同级元素。像底部示例一样使用它:

$(this).next("p")