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
  • 1 View
  • 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

I have a function that changes a dom element's text to a given value,
I have backbone view that binds an action to an element in the DOM.
I'm trying to select all dom elements that have id=mydiv but exclude the ones
Is there a way to remove a dom element from the document, but save
I have a DOM element that in Firebug clearly shows a float: left property.
I have... element = document.elementFromPoint(x, y) then I want to do something like... index
I have a dom element with html inside chat contains some html elements I'd
I have a DOM element that I am storing the offset position of. For
i have a DOM element with class='tag'. i want to check if the class
I have a DOM element that is generated with js, and therefore when i

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.