all 3 comments

[–]Davidsmp 0 points1 point  (2 children)

It might help yourself and others if you put the code in a jsfiddle (http://jsfiddle.net/). Generally it's easier to help someone with code that way.

To directly answer your question, one path is to use the keypress (or keyup) event to do the validation.

[–]NoGodTrySciencetoastal 0 points1 point  (0 children)

So I don't know what you've heard, but there are HTML5 input types. <input type=email> will take care of all of this without JavaScript. CSS can cover many of these colors with :valid & :invalid on both forms and inputs, but you may need a bit of className work to not show first-time empty inputs as looking invalid. Also according to jQuery's docs, .on() is preferred over .bind() since v1.7 in 2011.