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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:30:33+00:00 2026-05-11T08:30:33+00:00

I wrote some JavaScript to allow editing a list of items within an HTML

  • 0

I wrote some JavaScript to allow editing a list of items within an HTML form, including adding and removing items. Got it working in Firefox. When trying it in Internet Explorer, I found that any added items were not being submitted with the form.

Long story short… lots of simplification, debugging, figured out what line is triggering IE to ignore the new form input. So the behavior problem is solved.

But now I must ask: Why? Is this an IE bug?

Here is the simplified code:

<html> <head>     <title>Test</title>     <script type='text/javascript'>         function add() {             div = document.getElementById('mylist');              // *** Adding text here works perfectly fine. ***             div.innerHTML += ' ';              e = document.createElement('input');             e.setAttribute('type', 'text');             e.setAttribute('name', 'field3');             e.setAttribute('value', '--NEWVALUE--');             div.appendChild(e);              // *** Adding text here works perfectly fine in Firefox, but for             //     Internet Explorer it causes field3 to not be submitted. ***             //div.innerHTML += ' ';         }     </script> </head> <body>     <form action='' method='get'>         <div id='mylist'>             <input type='text' name='field1' value='value1' />             <input type='text' name='field2' value='value2' />         </div>         <a href='javascript:' onclick='add()' />Add</a>         <input type='submit' value='Submit' />     </form> </body> </html> 

To try it out, do the obvious: load in IE, click Add, click Submit, look what’s in the address bar. If you uncomment the last line in add(), IE will suddenly stop reporting field3. It works fine either way in Firefox.

Any ideas? A curious mind wants to know. (And how would I add text there if needed, in a portable fashion, so IE is happy?)

  • 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. 2026-05-11T08:30:33+00:00Added an answer on May 11, 2026 at 8:30 am

    Is this an IE bug?

    Seems so. When you create an <input> element through DOM methods, IE doesn’t quite pick up the ‘name’ attribute. It’s sort-of-there in that the element does submit, but if you try to get an ‘innerHTML’ representation of the element it mysteriously vanishes. This doesn’t happen if you create the element by writing directly to innerHTML.

    Also if you use DOM Level 0 form navigation methods, like ‘myform.elements.x.value’, access through the ‘elements’ array may not work (similarly the direct ‘myform.x’ access some people misguidedly use). In any case these days you might prefer getElementById().

    So either use innerHTML or use DOM methods; best not to mix them when creating form fields.

    This is documented (see ‘Remarks’) and finally fixed in IE8.

    In any case, never do:

    div.innerHTML+= ‘…’;

    This is only syntactical sugar for:

    div.innerHTML= div.innerHTML+’…’;

    In other words it has to serialise the entire child HTML content of the element, then do the string concatenation, then re-parse the new string back into the element, throwing away all the original content. That means you lose anything that can’t be serialised: as well as IE’s bogus half-created ‘name’ attributes that also means any JavaScript event handlers, DOM Listeners or other custom properties you have attached to each child element. Also, the unnecessary serialise/parse cycle is slow.

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

Sidebar

Ask A Question

Stats

  • Questions 78k
  • Answers 79k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Try this. May 11, 2026 at 3:58 pm
  • added an answer You should use an inline tag like <span> May 11, 2026 at 3:58 pm
  • added an answer Does it have to be done within vim? Could you… May 11, 2026 at 3:58 pm

Related Questions

I run a website (sorta like a social network) that I wrote myself. I
Here's a question that's been haunting me for a year now. The root question
Say that I write an article or document about a certain topic, but the
I'm writing a web app that will be making requests via AJAX and would

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.