-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.js
More file actions
19 lines (14 loc) · 892 Bytes
/
Copy pathjavascript.js
File metadata and controls
19 lines (14 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
document.addEventListener("DOMContentLoaded",
function () {
const form = document.querySelector(".contact-form");
form.addEventListener("submit", function (event) {
event.preventDefault(); // Evita que la página se recargue
const nombre = document.getElementById("nombre").value;
const email = document.getElementById("email")?.value || "";
const comentarios = document.getElementById("comentarios")?.value || "";
alert("Datos enviados correctamente:\n\n" +
"Nombre: " + nombre + "\n" +
"Email: " + email + "\n" +
"Comentarios: " + comentarios);
});
});