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

  • Home
  • SEARCH
  • 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 6740327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:35:35+00:00 2026-05-26T11:35:35+00:00

I am using IE 8 and trying to set an an elements Id attribute.

  • 0

I am using IE 8 and trying to set an an elements Id attribute. I then append that element to a parent element and check it’s innerHTML. The problem I see is that the id attribute is missing double quotes. At first I thought this might be cause i was using setAttribute property and that might be buggy in IE 8, so i used jQuery to set attribute values but the problem was still there. Heres my code…

            var imgId="my" + val_imgarea + "img";
            var img=document.createElement('img');
            $(img).attr("Id",imgId);
            img.setAttribute('src',name);
            img.setAttribute('style',"width:100%;height:100%");
            $(img).click(function(){clic(imgId);});

            var input=document.createElement('input');
            input.setAttribute('type','text');
            input.setAttribute('id',name);
            input.setAttribute('style',"display:none");

            var parent=document.getElementById(newArea);
            parent.appendChild(img);
            parent.appendChild(input);

            alert($("#"+newArea).html());

output is

<IMG id=my21img style="width:100%;height:100%" src="a/img.jpg" />

I need the double quotes with the id cauze I then write this html to a file and then some other applications read it and its causing problems cauze of the missing quotations.

  • 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-26T11:35:35+00:00Added an answer on May 26, 2026 at 11:35 am

    HTML doesn’t require attributes to be wrapped with quotes, IE 8 and lower returns attributes without quotes unless they have white space in them. The other applications parsing this HTML are clearly not HTML parsers and, if they are intended to be, the fault needs fixing with them.

    ‘In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend using quotation marks even when it is possible to eliminate them.’

    • http://www.w3.org/TR/html4/intro/sgmltut.html#attributes

    Note that, in your output, you have a closing slash / at the end of the <IMG tag. Internet Explorer doesn’t put those in either (I don’t think any browser does). This is an XML idiom and also not required for HTML.

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

Sidebar

Related Questions

I'm trying to set the focus on a text input element using document.getElementById( 'id'
I'm trying to set the attribute of an element programmatically, but firebug keeps giving
Using jQuery I am trying to set focus for (CSS purposes) to a particular
Trying to set up caching on our datasets - we're using clr stored procedures
I am trying to set Session values using a IHttpModule. I have set the
I'm trying to set the background image of canvas using canvas.setBackgroundImage(image); How can i
I am trying to set up a streaming WCF service using basicHttpBinding. The service
I'm trying to set Excel cell colors using Apache POI in Java. I played
I'm trying to set up integration tests using the AbstractTransactionalJUnit4SpringContextTests base class. My goal
So we're trying to set up replicated repositories using PlasticSCM, one in the US,

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.