I am learning JS and I am not yet familiar with internal workings. Can someone point out the error in my thinking? The basic idea is to ask a complex question, construct the answer with JS (to a CSV syntax) and feed it to a textbox. (From here it will be processed to a db.) Example included below: How many children do you have? What is their names and age?Perhaps, the new element generated by the first button is not added to the document? How to do this, or how to address the value in it?How can I make the values submitted to previous lines stick in the event of adding a new line. For example \[code\]'Jack'\[/code\] and \[code\]'10'\[/code\] is written to the first line, the user pressed the add new line, than this information should stay in the first line.Incorrectly working example: The save button stops working if the code in the loop is added.\[code\]<!doctype html><html lang="en"> <head> <meta charset="utf-8" /> </head> <body> <p>How many children do you have? What is their names and age?</p> <input type="text" id="qchildren" /> <div id="qchildren-answer-wrapper"></div> <button type="button" onclick="addNew()">Add new entry</button> <button type="button" onclick="save()">Save</button> <script> var lines = 0; function addNew() { lines++; document.getElementById("qchildren-answer-wrapper").innerHTML += 'Gyermek neve:<input type="text" id="qchildrenname' + window.lines + '" /> Gyermek eletkora:<input type="text" id="qchildrenage' + window.lines + '" /><br/>'; } function save() { var answer = ''; for (var ii = 0; ii < window.lines; ii++) { answer += document.getElementById('qchildrenname' + ii.toString()).value.toString() + ',' + document.getElementById('qchildrenage' + ii.toString()).value.toString() + ';'; } document.getElementById("qchildren").value = http://stackoverflow.com/questions/14056334/answer; } < /script> </body></html>\[/code\]