-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
23 lines (21 loc) · 1023 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//validating the send page
document.querySelector("#submit").addEventListener("click", function(event) {
//getting connnection to form textbox
const form_txt = document.querySelector("#From");
const to_txt = document.querySelector("#To");
const amount_txt = document.querySelector("#Amt");
//checking if textbox is empty or not if empty prevent the submission of form
if(form_txt.value ===""|| to_txt.value==="" || amount_txt.value===""){
alert("Error: Some of Fields are Empty!! ")
event.preventDefault();
}
else if(form_txt.value === to_txt.value){ //checking if names entered on textbox i.e. from and to if both are same so prevent the form submission
alert("Error: Please Enter Another name!! ")
event.preventDefault();
}
else{ //Finally asking user to continue if yes then form submit else form wil not submitted
const value = confirm("Are you sure you want to continue?");
if(!value)
event.preventDefault();
}
}, false);