Posted By

Ginko on 12/19/13


Tagged

XPath


Versions (?)

Easy XPath Single Node Getter


 / Published in: JavaScript
 

Is called this way :

var myNode = getNode(myXPath, targetRootNode);

  1. function getNode(xpathStmt, node) {
  2. return document.evaluate( xpathStmt, node, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue;
  3. }

Report this snippet  

You need to login to post a comment.