开发者

Non-trivial selections using jQuery based on content of previous element

Consider the following markup:

<x>
   <y>code1</y>
   <z>stuff</z>
开发者_如何学运维   <y>code2</y>
   <z>foobar</z>
</x>

Using jQuery, how do I select the <z>foobar</z> node in the given markup using the following rule: find the z-node that follows after a y-node which has a body containing "code2"?


Like this:

$('y:contains("code2") + z')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜