-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
44 lines (40 loc) · 1.19 KB
/
index.html
File metadata and controls
44 lines (40 loc) · 1.19 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Regular Expression Js</title>
<link rel="stylesheet" href="style.css">
<script>
function validate(){
var email=document.getElementById("email").value;
var reg=/^([a-zA-Z0-9\._]+)@([a-zA-Z0-9])+.([a-z]+)(.[a-z]+)?$/;
var result=reg.test(email);
if(result==false){
alert("invalid email id!");
return false;
}else{
alert("success !")
}
return true;
}
</script>
</head>
<body>
<div class="card">
<h1> Email Validation Using Regular Expression Js</h1>
<!-- form -->
<form action="" method="post" onsubmit="return validate()">
<!-- Email -->
<input type="text" name="email" placeholder="Enter Your Email" id="email"/>
<br/>
<br/>
<!-- Button -->
<button type="submit" name="submit">Register</button>
<br>
<!-- credit -->
<a href="https://github.com/nvanxndhu">©anandhunv</a>
</form>
</div>
</body>
</html>