Skip to content

Instantly share code, notes, and snippets.

@edo9k
Created February 20, 2020 16:32
Show Gist options
  • Save edo9k/14059ecdf3b81c5b5a136172b32ef46b to your computer and use it in GitHub Desktop.
Save edo9k/14059ecdf3b81c5b5a136172b32ef46b to your computer and use it in GitHub Desktop.
Xpath, innerHTML, etc
// seletor com xpath
/html/body/table/tbody/tr[3]/td/table/tbody/tr/td[1]
// fn que pega elemento via xpath
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
// sobrescrever com innerHTML
elemento.innerHTML = '<span>novo html</span>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment