View Single Post
Old 10-25-2012, 01:20 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
The submit button will refresh the page (reload it from server or cache). And the reloaded version will not contain the previously dynamically added rows.

To prevent the page from refreshing, you should "return false" and the function should be called onsubmit of the form instead of onclick of the submit button.
Code:
<form onsubmit="addRow(); return false;">
Name:<br>
<input type="text" id="name"><br>
Last Name: <br> 
<input type="text" id="lname"><br>
Age: <br>
<input type="text" id ="year"><br>
<input type="submit" id ="buton" value="Submit">
</form>
devnull69 is offline   Reply With Quote
Users who have thanked devnull69 for this post:
johnwalker (10-25-2012)