-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidiation.html
35 lines (30 loc) · 970 Bytes
/
validiation.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
<html>
<head>
<title>validiation in javascript</title>
<script type="text/javascript">
function validate()
{
var username=document.getElementById("uname");
var password=document.getElementById("pass");
if(username.value.trim()==""||password.value.trim()=="")
{
alert("no blank value allowed");
return false;
}
else
{
return true;
}
}
</script>
</head>
<body>
<form onsubmit="return validate()"
action="message1.html">
<input id="uname" placeholder="username" type="text" required/><br><br>
<input id="pass" placeholder="password" type="password" required/><br><br>
<button onclick="validate()"
type="submit">submit</button>
</form>
</body>
</html>