Looking for resolution to codepen issue (or perhaps a larger gap in my knowledge). When I try to append an element to the page, it returns
null, even when it is clearly not.
Or maybe it is??
<div id='search-bar'> <input id='input' type='text' placeholder='enter text'/> </div> <div id='error-message'></div> </div>
I try to append a simple string as an message. Not only is there an error in the console, I cannot even select the DOM node in the console.
< document.querySelector("#error-message") < null
var node = document.createTextNode('p'); document.querySelector('#error-message').appendChild(node)
But if I find the node,
error-message and click on it, then it allows me to target it. Why is this?
jquery behaves slightly better. At least the node appears with a value of 0, but at least it’s not blank. Still, not usefull.
This occurs for all html elements that are not physically visible, i.e. blank divs.
This has throw an unnecessary wretch into development causing bugs that I am not sure are legit. Or is this a thing?