/    Sign up×
Community /Pin to ProfileBookmark

text cursor in textarea

I need for a javascript.
On my page I have two
textareas:

<input name=”ta1″ value=””>
<input name=”ta2″ value=””>

Is possible when the text cursor is in
textarea “ta1” and I press Enter button on the keyboard,
the script to alert “Now you will send your name us”
(this massage with OK button).
When the text cursor is in
textarea “ta2” and I press Enter button,
the script to alert “Now you will send your email us”
(this massage with OK button).

Thank you in advance.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@xataku_nakusuteAug 17.2003 — uhhh....well...im unsure of the whole purpose of this code....but im also unsure of how to implement the enter press....

but heres kinda what youre looking for:

<input type="text" name="ta1" value="" onmouseover="alert('Now you will send your name us')">

<input type="text" name="ta2" value="" onmouseover="alert('Now you will send your email us')">

that basically does the same, but with exclusion of the pressing enter part.

also....these input fields are called textBOXES not textareas. that kinda threw me off for a sec.

when referring to textareas, youre talkin bout

<textarea></textarea>

and textboxes

<input type="text>
Copy linkTweet thisAlerts:
@vinsaauthorAug 17.2003 — Thanks but I want when the text cursor is in textarea and I press Enter button on the keyboard.
Copy linkTweet thisAlerts:
@xataku_nakusuteAug 18.2003 — <input type="text" name="ta1" value="" onmouseover="focus()" onmouseout="blur()" onkeydown="alert('Now you will send your name us')">

<input type="text" name="ta2" value="" onmouseover="focus()" onmouseout="blur()" onkeydown="alert('Now you will send your email us')">

thats prolly more of what youre looking for

EDIT: sorry for messing up again.

the code above will make the alert poup whenever ANY kboard button is pressed.....which in turn would make your forms very annoying

ill try to get you the right code soon
×

Success!

Help @vinsa 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.17,
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,
)...