Created
July 21, 2022 17:57
-
-
Save hunsly/e8a628286bf4da278cf4fa592b415211 to your computer and use it in GitHub Desktop.
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
/** | |
Example: | |
getHTMLSubElements(HTML, '.cssSelector'); | |
getHTMLSubElements(HTML, '#idSelector'); | |
getHTMLSubElements(HTML, 'SubTagName .cssSelector'); | |
*/ | |
function getHTMLSubElements(HTML, sel) { | |
let root = document.createElement("DIV"); | |
root.innerHTML = HTML; | |
return root.querySelector(sel); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment