Meep3D
Meep3D

Reputation: 3756

jQuery realtime form validation

I am currently using $.blur(fn();) for form validation, but this only takes effect when the form field loses focus. Is there a way of doing it on keypress to get realtime validation? I suppose I could do the 'poll all fields every second' approach, but I am sure there must be a more elegant way?

Upvotes: 3

Views: 3881

Answers (4)

Dev Sahoo
Dev Sahoo

Reputation: 12101

I hope this plugin helps

http://www.geektantra.com/2009/09/jquery-live-form-validation/

Upvotes: 2

MitMaro
MitMaro

Reputation: 5927

Since your using jQuery you should look into the jQuery Validation Plugin. It will take care of the events for you. :)

Upvotes: 2

Geoff
Geoff

Reputation: 9340

You can use $.keyup

Upvotes: 4

Clyde
Clyde

Reputation: 8145

There are lots of other events you could use. See here: http://docs.jquery.com/Events

I would recommend change or keypress or keydown.

Upvotes: 2

Related Questions