I'm trying to create text box in a table on button click. I've wrote javascript code in the button click and it works. My problem is that data entered in the textbox of previous row is cleared when adding next row of textbox. Code and screen shots are given. Please help to solve this problem.\[code\]function addRow(tableID) { var table = document.getElementById(tableID); var count = table.rows.length - 1; table.innerHTML += "<tr> <td>"+count+"</td> <td><input type='text' id='date" + count + "' size='20'></td> <td><input type='text' id='from" + count + "' size='20'></td> <td><input type='text' id='to" + count + "' size='20'></td> <td><input type='text' id='mode" + count + "' size='20'></td> </tr>";}\[/code\]
on clicking add button I lose data curresponding to Sl.no1]