I'm looking Jquery UI's modal form demo. But i want to add something. This demo checking all inputs' (name,email,password) lenght and validate them. But email input must be optional. Because of this i'm setting email input's min value (for checkLength() function) to zero. But when i leave blank email input i'm getting validation error. You can check full codes here .
It's validation email with this code :
bValid = bValid && checkRegexp( email, ..SOME REGEX PATTERNS WILL COME HERE.., "eg. [email protected]" );
But i want to try validation only if there is any email input. Because email input is optional and visitors can leave it. How can i add if statement (if email input is filled, validate it. Else don't try validation) to this code ? I hope it's clear.