/    Sign up×
Community /Pin to ProfileBookmark

script for populating a text field…..

Hi, first time posting here. I’m in a real bind.

I have a text field that needs to prepopulate another textfield via hitting the “tab” key.
For example– in one text field a user could type in “10” (as in $10), another text field on the page would then populate to “12” (as in $12).
Since this is for a demo the user would be given an inital value to type in the first field. I would then have another number prepopulate into the second field regardless of what the user typed in the first field.

I know this is possible since I already had the code for this. I’ve lost my file that contained this JavaScript.

Any help would be much appreciated.

Thank you.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Zach_ElfersJan 08.2003 — <form name="formName">

<input type="text" name="textField1" onBlur="document.formName.textField2.value=this.value;">

<input type="text" name="textField2">

</form>





That should work.
Copy linkTweet thisAlerts:
@paingoldauthorJan 08.2003 — I owe you a beer. thanks!
×

Success!

Help @paingold spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...