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 7052841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:25:56+00:00 2026-05-28T03:25:56+00:00

Here is the dilemma: I am doing a javascript effect. To do so I

  • 0

Here is the dilemma:

I am doing a javascript effect. To do so I am pulling a node and it’s children (including images) with .innerHTML. Then trying to parse it via the DOM. When it gets to the image tags it throws a parse error. When I alert the innerHTML I see that it is stripping the closing for the IMG tags.

I am not sure if the problem is with the parser or innerHTML. How can I take this node, grab the internal contents, parse it as XML?

Looks like a similar thing happened here: innerHTML removing closing slash from image tag

(This is the only page in the internet that I found that touches on this issue after almost two Days of searching.)

Here is the parse code I am using:

function loadXMLString(txt) {
    if (window.DOMParser) {
        parser=new DOMParser();
        xmlDoc=parser.parseFromString(txt,"text/xml");
    } else { // Internet Explorer
        xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async="false";
        xmlDoc.loadXML(txt); 
    }
    return xmlDoc;
}

The resolution was to change the mime type, but how do you do that with the javascript parser (both MS ActiveX and the other browser’s standard)? What mime should I use?

Here is the DOM Element I am attempting to parse:

<div style="display:none" id="ItemsContainer" name="ItemsContainer">
    <SPAN>
       <a href="url1"><img src="1.jpg" alt="alt1" /></a>
       <a href="url2"><img src="2.jpg" alt="alt2" /></a>
       <a href="url3"><img src="3.png" alt="alt3" /></a>
       <a href="url4"><img src="4.jpg" alt="alt4" /></a>
    </SPAN>
</div>

If I change the tags to another name, like then it works. It seems that innerHTML is breaking the tag or that the parser can’t parse IMG tags.

Please advise.
Thanks In Advance!

  • 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-28T03:25:56+00:00Added an answer on May 28, 2026 at 3:25 am

    IE automatically capitalizes Tag names (so becomes ) so I used txt.replace(/><\/a>/g, " /></a>").replace(/><\/A>/g, " /></A>")

    Thanks to all who helped!

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

Sidebar

Related Questions

Here's my dilemma: I have to RGBA RAW images: a master image (the first)
Ok here's my dilemma. here's this code I have: If e.KeyCode = Keys.A Then
Here's a screenshot of my chrome javascript console demonstrating my dilemma. I seriously cannot
Here's my dilemma. I'm using a RESTful ASP.NET service, trying to get a function
Here is my dilemma and thank you in advance! I am trying to create
Ok, here is my dilemma I have a database set up with about 5
Here's my dilemma: I have two types of routes which are semantically very different,
I'm running into a dilemma here. The Firefox Add-Ons SDK only allows PUT and
I'm not sure if I phrased that correctly but here's my dilemma. I inherited
Interesting dilemma here. I need the ability for users to add links from their

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.