What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » using js to add a form input, but retaining typed info?

using js to add a form input, but retaining typed info?
Author: Message:
stoshrocket
Senior Member
****

Avatar
formerly methos

Posts: 748
Reputation: 31
33 / Male / Flag
Joined: Aug 2005
O.P. using js to add a form input, but retaining typed info?
I've quickly knocked up the following:
HTML code:
<script type="text/javascript">
function add_input(){
document.getElementById('input_container').innerHTML += '<input type="text"><br />';
}
</script>
 
<div>
<form>
<div id="input_container">
<input type="text"><br />
</div>
<br /><input type="submit" value="submit">
</form>
<a href="#" onclick="add_input()">add input</a>
</div>

...which just adds a form input when you click the add input link. However, I want to be able to retain the information pre-entered in the inputs, so if I typed something into the first input, click add another, and I would have whatever I typed in the first plus another input (currently it just replaces the div contents with a new set of inputs). Any ideas?

This post was edited on 07-19-2009 at 10:46 PM by stoshrocket.
formerly methos
07-19-2009 10:27 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
using js to add a form input, but retaining typed info? - by stoshrocket on 07-19-2009 at 10:27 PM
RE: using js to add a form input, but retaining typed info? - by felipEx on 07-19-2009 at 11:14 PM
RE: using js to add a form input, but retaining typed info? - by stoshrocket on 07-20-2009 at 03:13 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On