/    Sign up×
Community /Pin to ProfileBookmark

textbox event?

hi, all i want to know is which event handler (onClick…… blah blah blah) will run when something is typed in a textbox? for example i have a textbox and every time a letter is typed in that textbox i want a function to run…

e.g. <input type=”text” on(whatver)=”function1();”>

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@NaldzNov 13.2006 — oninput
Copy linkTweet thisAlerts:
@cootheadNov 13.2006 — Hi there jam,

does this help...
[color=navy]&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;

&lt;script type="text/javascript"&gt;
&lt;!--
window.onload=function() {
document.getElementById('foo').onkeyup=function(){
alert(this.value);[color=purple]// replace this alert with your function[/color]
}
}
//--&gt;
&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div&gt;
&lt;input id="foo" type="text"/&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;[/color]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@jamauthorNov 13.2006 — lol cheers.. i knew that'd b simple
Copy linkTweet thisAlerts:
@cootheadNov 13.2006 — [color=navy]oninput[/color][/QUOTE]
[indent]

Well, I'm familiar with Lilliput but oniput is new to me. :eek:

[/indent]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@KravvitzNov 14.2006 — I'm not aware of an "oninput" event in JavaScript/DOM.

coothead shows the simplest way to avoid using inline event handlers.
×

Success!

Help @jam 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.18,
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,
)...