Answers for "how to access xpath in js"

1

how to access xpath in js

function getElementByXpath(path) {
  return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
Posted by: Guest on March-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language