-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
45 lines (34 loc) · 1.09 KB
/
index.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
44
45
// @ts-ignore
const appInit = async => {
console.log("Learning git has been loaded.");
// @ts-ignore
var userEmail = document.getElementById("userEmail")
?.addEventListener("click", function () {
console.log("Clicked");
});
}
document.addEventListener("DOMContentLoaded", appInit);
function addUser() {
var message = document.getElementById("message");
// Get the form element
var form = document.getElementById('myForm');
if (form){
// @ts-ignore
var userName = form.elements['userName'].value;
// @ts-ignore
var userEmail = form.elements['userEmail'].value;
// Perform validation
if (userName.trim() === '') {
if (message)
message.innerHTML = "Please enter your name."
return false; // Prevent form submission
}
if (userName.trim() === '') {
alert('Please enter your email.');
return false; // Prevent form submission
}
// @ts-ignore
form.submit();
}
// console.log("Submited");
}