5
   <!DOCTYPE html> 
    <html>
    <head>
    <title>Login Page</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet"href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
    </script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js">
    </script>
    </head>
    <body >     
    <div id="divi" height="100"> 
    <form class="form-inline" role="form">
    <div class="form-group" >
    <label class="sr-only" for="em">Email:</label>
    <input type="email" id="em" placeholder="Enter email" required >
    </div>
    <div class="form-group" >
    <label class="sr-only" for="pwd">Password:</label>
    <input type="password"  id="pwd" placeholder="Enter password" required>
    </div>
    <button type="button" class="btn btn-primary">Login</button>
    </form>
    </div>
    </body>
    </html>

Hi please help me to validate the user id with email id and the password should contain uppercase lowercase and atleast one character?

Sankar Karthi
  • 355
  • 2
  • 9
  • Possible duplicate of [Regular Expression for password validation](http://stackoverflow.com/questions/2370015/regular-expression-for-password-validation) – Steve Jan 10 '16 at 06:25

1 Answers1

1

Follow this guide:

http://www.webdesignerdepot.com/2012/01/password-strength-verification-with-jquery/

Here is an example of the Jquery code:

 //validate letter
 if ( pswd.match(/[A-z]/) ) {
     $('#letter').removeClass('invalid').addClass('valid');
} else {
     $('#letter').removeClass('valid').addClass('invalid');
}

//validate capital letter
if ( pswd.match(/[A-Z]/) ) {
    $('#capital').removeClass('invalid').addClass('valid');
} else {
    $('#capital').removeClass('valid').addClass('invalid');
}

//validate number
if ( pswd.match(/\d/) ) {
    $('#number').removeClass('invalid').addClass('valid');
} else {
    $('#number').removeClass('valid').addClass('invalid');
}

[A-z] This expressions checks to make sure at least one letter of A through Z (uppercase) or a through z (lowercase) has been entered

[A-Z] This expressions checks to make sure at least one uppercase letter has been entered

\d This will check for any digits 0 through 9

Badrush
  • 1,247
  • 1
  • 17
  • 35