I am making a small form for a php app and had a question regarding javascript validation.
What is the best event to run the javascript validation on the input value? Is it the “focusout” event?
I used “focusout” to originally but it creates problems when the user hits enter while they are still focused on any particular field in the form.
Should I run the js validation when the user clicks submit?
Just looking for some advice.
Thanks!
Chuck
I maybe wrong and I often am, but instead of using focusout, you might wanna try using .change()
This should register whatever value that the user entered into the textbox, even if they hit the Return key. In fact, it should register if the user hits the tab key, clicks anywhere outside of the textbox, clicks the submit button, and essentially whenever focus is lost on the form field.