How can one select specific sibling of a context node using jQuery?
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")
精彩评论