问题
I have the following function in JavaScript
, and it fails to run when using Internet Explorer
.
This function extract the value from a HTML tag
, if a XPath
is supplied.
How can i replace this function, and with what ?
function lookupElementByXPath(path) {
var evaluator = new XPathEvaluator();
var result = evaluator.evaluate(path, document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null);
return result.singleNodeValue;
}
来源:https://stackoverflow.com/questions/12927990/javascript-xpathevaluator-not-supported-in-ie