-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.html
72 lines (60 loc) · 1.7 KB
/
demo.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="src/jquery.textcomplies.js"></script>
</head>
<body>
<div>
<label for="password">Password:</label>
<br />
<input name="password" type="password" id="password" />
<br />
<label for="password_match">Confirm Password:</label>
<br />
<input name="password_match" type="password" id="password_match" />
</div>
<div id="password_compliance">
</div>
<input type="button" value="submit" id="my_button" disabled />
<script>
$('#password').textComplies({
output: $('#password_compliance'),
minLength: 3,
maxLength: 12,
numNumbers: 4,
disallowed: [ ' ', '$', 'password' ],
disallowedText: 'Contain no @',
matchField: $('#password_match'),
matchPattern: "^[A-Za-z]",
matchPatternText: "Start with a letter",
onComplies: passwordComplies,
onDefies: passwordDefies,
validateOnStart: false,
showAsFailOnStart: false
});
function passwordComplies() {
$('#my_button').removeAttr('disabled');
}
function passwordDefies() {
$('#my_button').attr('disabled', true);
}
</script>
<style>
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 18px;
margin: 40px;
}
.complies {
background-color: green;
}
.defies {
background-color: red;
}
#password_compliance {
border: 1px solid black;
display: none;
}
</style>
</body>
</html>