[Javascript] Programmatically set onchange event for textbox

Matt Warden mwarden at gmail.com
Wed Oct 4 09:55:48 CDT 2006

On 10/4/06, Glenn E. Lanier, II <glenn_lanier at netzero.net> wrote:
> > -----Original Message-----
> > From: Brian L. Matthews
> > Sent: Wednesday, October 04, 2006 12:25 AM
> > onchange only fires when the field loses focus (i.e. you tab out or
> > click the page somewhere outside the field). That's often sufficient
> > (it usually doesn't make sense to do field validation on a partially
> > typed field). If you want to validate the first digit as soon as it's
> > typed, look into the onkey events, but make sure you read about
> > browser compatibility (<http://www.quirksmode.org/> is a good site,
> > I'm sure there are others).
> Thanks. That would have given me some grief.

You would be better off using a timeout approach, otherwise your
events are tied to typing speed of the user, which typically makes no
sense for what you're trying to do.

Matt Warden
Cleveland, OH, USA

This email proudly and graciously contributes to entropy.

More information about the Javascript mailing list