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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:14:48+00:00 2026-06-08T13:14:48+00:00

I have had this problem for a while and it has been driving me

  • 0

I have had this problem for a while and it has been driving me crazy! It’s not crashing my site or making it unusable but is infuriating nonetheless. I have a tag so users can create up to ten questions to any given answer inside a form, and a javascript button so that they can add another answer. The trouble I am having is that if they add some answer text fields with the button and fill them in, when they go to add another answer with the button it over-writes all of the answers they have just submitted! The link to the jsfiddle is http://jsfiddle.net/EkUmG/ and here is the code from my actual html document that is pertinent (i would include the entire file but there is php on it so you couldnt just drag and drop it into the browser anyway)

  • thanks for any help in advance

here is the html

<div id='buttons'></div>

(and yes i realize that is an inappropriate name for that div, sorry about that)

and here is the javascript

<script type="text/javascript">
    var answers = 0;
    var inHTML = "";
    function addAnswer()
    {
       if(answers < 10){
       write = document.getElementById('buttons');
       write.innerHTML = write.innerHTML + "answer: <input type=\"text\" name=\"answer"    + answers + "\" /> <br>";
       answers = answers + 1;}
    }
</script>
  • 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-06-08T13:14:51+00:00Added an answer on June 8, 2026 at 1:14 pm

    By writing to the innerHTML property you make the browser re-parse all the content, therfore resetting the input fields’ values.

    Instead, use insertAdjacentHTML (Demo).

    Note that this method is supported by FF only since version 8. You might use this polyfill or go with @Stano’s solution if you need to support lower versions.

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

Sidebar

Related Questions

This problem has been bugging me for a while. I have to load a
Has anyone had this problem? My projects tend to have some long XML files
(I have a problem that I illustrated in this question but had no correct
This has been plaguing me for a while. I have a page in my
This has been bugging me for a while. I have this ircbot that I
I've been thinking about this problem for a while and have yet to come
I have a problem which has been driving me mad for days - I've
I have been trying to figure this problem out without asking for help, but
I have posted on this topic before, but as yet I have not had
I have had this problem crop up a few times and I can't figure

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.