Skip to content

Instantly share code, notes, and snippets.

@emchateau
Created July 1, 2020 04:45
Show Gist options
  • Save emchateau/aae67372fbf27b761c1ce77bfdd89c94 to your computer and use it in GitHub Desktop.
Save emchateau/aae67372fbf27b761c1ce77bfdd89c94 to your computer and use it in GitHub Desktop.
XPath in Javascript
var element = document.evaluate( '//body//form/p/textarea' ,document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue;
if (element != null) {
element.value = '...';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment