0

What's the best way to realize it?To do a check on blur ,or on key up/down ?

2 Answers 2

1

I'd use the jQuery Validation framework...it'll handle it all for you.

It's highly customisable too.

Sign up to request clarification or add additional context in comments.

2 Comments

But I don't want to use plugins.
@Iam3r4370 - Why don't you want to use Plug-ins out of a matter of interest? You'll be making your like much harder. Things like jQuery - the plug-in - will wrap up the differences between browsers, so you don't have too. Plug-ins have their place... Is there a specific reason? Security/ Project Requirement...?
0

Ok, if you don't want to use plugins and you want to make your life harder ;) then you have to see when you want the error to be displayed. Jquery Validation uses events on submit, blur and keydown. So you will need to attach all these events and make sure everything is valid on submit. Then let's say you were looking for a valid email, which is not valid. So on keydown you can check to see if the email is valid and remove the warning. All this work has been done in the plugin.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.