I'm not sure if this is possible, but I am creating an element using document.createElement, then appending child elements to that variable to build a sort of template prior to adding it to the page. As such, this element is not in DOM yet. I'd like to be able to directly access the child elements by their ID, rather than trying to use the children property to find them. Is it possible to use something like element.getElementById to find child elements within that parent element before it's added to DOM, as if it were its own mini-DOM?
rough example:
var parentElmt = document.createElement('DIV');
var childElmt = document.createElement('DIV');
childElmt.id = "child1";
parentElmt.appendChild(childElmt);
parentElmt.getElementById('child1').innerHTML = "Does this work?";
getElementById()on element is not web compatible - i.e. A significant number of existing web pages would break if element.getElementById() worked. So use querySelector instead as per Jaeeun Lee's answer.