I have a DOM element in memory that is yet to be injected in the page DOM.
I want to lookup an element by id inside this DOM element but document.getElementById wont work as the element is not yet in the page DOM.
Any ideas on how to do this?
P.S.
- I know one approach is to use
element.querySelector() but since IE7
doesnt support it, I can’t. - Not using Jquery
It differs on if the browser is IE or non-IE. In either case you should use
XPath. For Firefox and other compliant browsers, you would useevaluateand the Xpath query, with IE, you useselectNodes. So here they are side by side:And then do what you need to do with the element. I’m a bit embarrassed that IE actually makes this more clear cut, but every dog has it’s day.