Easy XPath Single Node Getter


/ Published in: JavaScript
Save to your folder(s)

Is called this way :

`var myNode = getNode(myXPath, targetRootNode);`


Copy this code and paste it in your HTML
  1. function getNode(xpathStmt, node) {
  2. return document.evaluate( xpathStmt, node, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue;
  3. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.