"Advance Password Validation"
Bootstrap 3.3.0 Snippet by bmrafiq

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4 text-center">
<div class="search-box">
<div class="caption">
<h3>Advance Password Validation</h3>
<p>Find to All</p>
</div>
<form action="" class="loginForm">
<div class="input-group">
<input type="text" id="name" class="form-control" placeholder="Full Name">
<input type="password" id="paw" class="form-control" placeholder="Password">
<input type="submit" id="submit" class="form-control" value="Submit">
</div>
</form>
</div>
</div>
<div class="col-md-4">
<div class="aro-pswd_info">
<div id="pswd_info">
<h4>Password must be requirements</h4>
<ul>
<li id="letter" class="invalid">At least <strong>one letter</strong></li>
<li id="capital" class="invalid">At least <strong>one capital letter</strong></li>
<li id="number" class="invalid">At least <strong>one number</strong></li>
<li id="length" class="invalid">Be at least <strong>8 characters</strong></li>
<li id="space" class="invalid">be<strong> use [~,!,@,#,$,%,^,&,*,-,=,.,;,']</strong></li>
</ul>
</div>
</div>
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* Base CSS */
.alignleft {
float: left;
margin-right: 15px;
}
.alignright {
float: right;
margin-left: 15px;
}
.aligncenter {
display: block;
margin: 0 auto 15px;
}
a:focus { outline: 0 solid }
img {
max-width: 100%;
height: auto;
}
.fix { overflow: hidden }
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0 0 15px;
font-weight: 700;
}
html,
body { height: 100% }
a {
-moz-transition: 0.3s;
-o-transition: 0.3s;
-webkit-transition: 0.3s;
transition: 0.3s;
color: #333;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$(document).ready(function(){
$('input[type=password]').keyup(function() {
var pswd = $(this).val();
//validate the length
if ( pswd.length < 8 ) {
$('#length').removeClass('valid').addClass('invalid');
} else {
$('#length').removeClass('invalid').addClass('valid');
}
//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');
}
//validate space
if ( pswd.match(/[^a-zA-Z0-9\-\/]/) ) {
$('#space').removeClass('invalid').addClass('valid');
} else {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments:

Love the "password must be requirements " Great work

Stan Williams () - 7 years ago - Reply 0


Pretty Cool.

But I'd personally say that custom CSS for just this form doesn't make sense, as the same could be done with the built-in bootstrap classes.

Especially the button, which it's far easier to set it as <input type="submit" id="submit" class="form-control btn-block btn btn-danger" value="Submit">

Which you can then change the colour of if needs be by editing the SCSS files if using the non-compiled, or through editing the custom.css if using the CDN version.

George Langham () - 7 years ago - Reply 0


nice

fsdfs () - 7 years ago - Reply 0


Thank You :)

bmrafiq () - 7 years ago - Reply 0