[removed] use xpath in jQuery

前端 未结 8 1356
耶瑟儿~
耶瑟儿~ 2020-12-14 10:16

I have, for example, the next XPath query:

//div[span=\"something\"]/parent::div/child::div[@class=\\\"someClass\\\"]

I want to use this XP

8条回答
  •  悲哀的现实
    2020-12-14 10:43

    if you want to select an element inside an iframe, from parent window, you should change second parameter of evaulate() function to iframe's document element, like :

    var iFrameDocument = $('iframe#myPage').get(0).contentWindow.document;
    xpathResult = this[0].evaluate(xpathExpression, iFrameDocument, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
    

提交回复
热议问题