-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform_validation.html
More file actions
49 lines (42 loc) · 1.48 KB
/
form_validation.html
File metadata and controls
49 lines (42 loc) · 1.48 KB
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
<!DOCTYPE html>
<html lang="en" ng-app="demo">
<head>
<meta charset="UTF-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>demo</title>
</head>
<body>
<form action="" method="POST" id="" name="" onsubmit="return submitData()">
<label>Name</label>
<input type="text" name="" value="" id="name" />
<br/>
<label>Email</label>
<input type="email" name="" value="" id="email" />
<br/>
<label>Mobile</label>
<input type="number" name="" value="" id="number" />
<br/>
<button type="submit">Submit</button>
</form>
<script>
function submitData(){
if(document.getElementById('name').value == ''){
alert('Please Enter name');
document.getElementById('name').focus();
return false;
}
else if(document.getElementById('email').value == ''){
alert('Please Enter Email id');
document.getElementById('email').focus();
return false;
}
else if (document.getElementById('number').value==''){
alert('Please enter mobile no.');
document.getElementById('number').focus();
return false;
}
}
</script>
</body>
</html>