开发者

How can one select specific sibling of a context node using jQuery?

开发者 https://www.devze.com 2022-12-26 02:13 出处:网络
How can one select a specific sibling of a context node using jQuery? Specifically, gi开发者_StackOverflowven context node myContextNode select the sibling span with class myClass.

How can one select a specific sibling of a context node using jQuery? Specifically, gi开发者_StackOverflowven context node myContextNode select the sibling span with class myClass.

document.evaluate("../span[@class='myClass']",
    myContextNode, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).
    singleNodeValue;


You can use .siblings() with a selector, like this:

$(myContextNode).siblings("span.myClass")
0

精彩评论

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