-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
38 lines (36 loc) · 1.11 KB
/
app.js
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
var main = function() {
$('form').submit(function() {
var firstName = $('#first').val();
if(firstName === "") {
$('.first-name-error').text("Please enter your first name.");
}
return false;
});
$('form').submit(function() {
var lastName = $('#last').val();
if(lastName === "") {
$('.last-name-error').text("Please enter your last name.");
}
return false;
});
$('form').submit(function() {
var email = $('#email').val();
var taken = "[email protected]";
if(email === "") {
$('.email-error').text("Please enter your email address");
} else if(email === taken) {
$('.email-error').text("This email is already taken.");
}
return false;
});
$('form').submit(function() {
var password = $('#password').val();
if(password === "") {
$('.password-error').text("Please enter your password");
} else if(password.length < 8) {
$('.password-error').text("Short passwords are easy to guess. Try one with at least 8 characters.");
}
return false;
});
};
$(document).ready(main);