Forum Moderators: open
Basically, my form contains 10 rows of text boxes.
And I want to have a button below the 10 rows of text boxes so when any user clicks on the button, it will create 10 more rows of text boxes (typical client-side javascript). And so on until the button has been clicked for 5 times.
Can anyone give me some hint on how I can start?
Thank you..
[webmasterworld.com...]
Your username is (very nearly) "dracula" backwards.
Since adding rows to a table can be done several ways, I'll just recommend the DOM methods I'd use (which differs from Bernard Marx's approach).
insertRow (called from a table object) and insertCell (called from the row object returned from insertRow)
document.createElement('input') which returns a new text box, and then needs to have attributes set using setAttribute.
Then the new text box needs to be added to the new cell by using appendChild.
The whole thing would go into a loop to create all 10. You may need to have some iteration logic if the names of the text boxes need to be different.
You can google around for those DOM methods to get a better idea of how to use them.