/    Sign up×
Community /Pin to ProfileBookmark

populate fields automatically via the TAB key

Hello,

I would like to enter text into an input field, hit the TAB key and auto-populate another field based on the value of the input field. Is there a way to do that any javascript?

Thanks for all of your help

Chess

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@UltimaterJun 22.2005 — Here ya go:
<i>
</i>&lt;input type="text" onkeypress="getTheKey(event,this)" value="hit tab after focus"&gt;&lt;br&gt;
&lt;input type="text" id="something" value=""&gt;

&lt;script type="text/javascript"&gt;
function getTheKey(){
var daKey=(typeof event=='undefined')?arguments[0].keyCode:event.keyCode;
if(daKey==9){//tab
copyContents(arguments[1])
}
return true
}

function copyContents(t){
document.getElementById("something").value=t.value
}
&lt;/script&gt;
Copy linkTweet thisAlerts:
@UltimaterJun 22.2005 — For failure to add a DOCTYPE, HTML tag, etc, you can add 'em in yourself.

I left 'em out on purpose so you can see my active code more clearly and also cas' someone is a bit lazy to add 'em all in.

Charles, wanna do the honors? ?
Copy linkTweet thisAlerts:
@chess25authorJun 22.2005 — Thank you very much Ultimater!!!....I will try this out
×

Success!

Help @chess25 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...