![]() |
input field resets when updating webpage
I have a webpage I am designing where there is at least one input text field, an add button, and a submit button. The add button will add another row containing an input text field and an add button.
The problem is that when I click the add button, the text in the input text field disappears. Here is a scaled down version of the code: Code:
<!DOCTYPE html> |
change this:
Code:
<input type=submit value=Add onclick="AddRow(0)">Code:
<input type="button" value="Add" onclick="AddRow(0)"> |
It still fails. I have this snippet up at http://www.thohug.org/test.php. If you type into the text box and click on add, you'll see the next text box come up, but the contents of the first text box disappear.
|
it's a nasty way of adding rows to a table, anyway (if you look at your current code, it creates a new tbody every time a row is added), and it will fail in IE (because rom what I understand IE cannot make "nested" elements - like <tr><td></td></tr> - using innerHTML
AND if you click the first button twice, you succeed in making two inputs with the id "outcome1" this, I think, is a better approach, which solves all the above plus your initial problem... Code:
<body> |
| All times are GMT +1. The time now is 07:25 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.