-
Notifications
You must be signed in to change notification settings - Fork 0
/
survey.js
39 lines (25 loc) · 989 Bytes
/
survey.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
39
////action
$(function(){
function isEmail(email)
{var pattern = /^([0-9a-zA-Z]([-_\\.]*[0-9a-zA-Z]+)*)@([0-9a-zA-Z]([-_\\.]*[0-9a-zA-Z]+)*)[\\.]([a-zA-Z]{2,9})$/;
return pattern.test(email);}
$('#buton').click(function(){
var errormessage="";
$("#error").html("");
if($("#email").val()==""){
errormessage+="<p>Please enter your e-mail</p>";
}
if(isEmail($("#email").val())==false){
errormessage+="<p>Email entered is not valid.</p>";
}
if($('#firstname').val()==''){
errormessage +='<p>Please enter your name</p>'
}
if($('#lastname').val()==''){
errormessage +='<p>Please enter your last name</p>'
}
if(errormessage!=""){
$("#error").html(errormessage);
}
});
});