Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 668183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:00:43+00:00 2026-05-14T00:00:43+00:00

I have a DOM element in memory that is yet to be injected in

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:00:43+00:00Added an answer on May 14, 2026 at 12:00 am

    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 use evaluate and the Xpath query, with IE, you use selectNodes. So here they are side by side:

    //Say you want an element with an id of "foo":
      var xpathQ = "//[@id='foo']";  // This is your query
    
      var myXML = someXMLsource;   // Get your XML  however you are getting it
    
     //Assuming non-IE
    
     var fooNode = myXML.evaluate(xpathQ, myXML, null, XPathResult.ANY_TYPE, null);
    
    //Assuming IE
    
    var fooNode = myXML.selectNodes(xpathQ);
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a DOM element which is dynamically added to the page, and
I have a javascript function that receives a dom element as a parameter. In
I have a rather complex HTML page, with a large DOM element tree. For
In using PHP's DOM classes (DOMNode, DOMEElement, etc) I have noticed that they possess
I have a javascript function that manipulates the DOM when it is called (adds
I have an XML file loaded into a DOM document, I wish to iterate
I have a page which is largely created by DOM script, which generates a
I want to write some javascript and have it call into the DOM for
Premise: I've started to study javascript and the DOM and I have this HTML
I have a simple XML document I'm trying to read in with Python DOM

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.