-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp1.js
29 lines (22 loc) · 950 Bytes
/
app1.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
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("form");
form.addEventListener("submit", function(event) {
event.preventDefault();
const username = document.getElementById("username").value;
const email = document.getElementById("email").value;
const password = document.getElementById("password").value;
if (username && email && password) {
sendEmail(email, username, password);
alert("Profile updated successfully!");
form.reset();
} else {
alert("Please fill in all fields.");
}
});
function sendEmail(email, username, password) {
console.log(`Sending email to ${email} with new credentials:
Username: ${username}
Password: ${password}`);
alert(`An email with your new credentials has been sent to ${email}.`);
}
});