Created
February 20, 2020 16:32
-
-
Save edo9k/14059ecdf3b81c5b5a136172b32ef46b to your computer and use it in GitHub Desktop.
Xpath, innerHTML, etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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