I'm trying to create some dynamic form fields using javascript. Basically the user enters some text in the new_option text field below and when they click the add_option button it adds a populated text field to a form that is already on the page. Anyone know how to do this off hand?
Code:
<input type="text" name="new_option"> <input type="button" name="add_option" value="Add Option" onClick="xxxx">
When button is pressed the new_options are outputed here as addtional text fields which can then be submitted with the main form.
Edit: I've come across an example at
http://www.openjs.com/scripts/examples/addfield.php that comes close to what I'm trying to do. Seems like it should work for me, just need to re-write it a bit to suit my needs.