-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
43 lines (38 loc) · 1.1 KB
/
script.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
40
41
42
43
var a=document.getElementById("input-field");
var b=document.getElementById("email");
var c=document.getElementById("sub");
var d=document.getElementById("msg");
var e=document.getElementById("form")
var btn1=document.getElementById("btn")
// var f=document.getElementsByClassName("right-div");
// function getdata(){
// if(a=="" || b=="" ||c=="" || d==""){
// alert("Enter fields");
// return false;
// }
// else{
// true;
// alert("Thank You");
// }
// }
// var e=document.getElementById("dark");
// e.addEventListener("click",()=>{
// f.style.backgroundColor="white";
// })
btn1.addEventListener("click",k=>{
k.preventDefault();
validateinputs();
});
const validateinputs=()=>{
const uservalue=a.value.trim();
const emailvalue=b.value.trim();
const subject=c.value.trim();
const msg=d.value.trim();
if(uservalue==='' || emailvalue===''|| subject===''||msg===''){
// setError(a,"Username is required")
alert("Enter fields ");
}
else{
alert("Thanks");
}
}