Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Desafío: Formularios | Tablas y Formularios
Conceptos básicos de HTML

book
Desafío: Formularios

Tarea

Crea un formulario HTML para recopilar comentarios de los usuarios. Pide a los usuarios que ingresen sus nombres y comentarios. En este ejercicio, incluiremos el script de JavaScript solo con fines de demostración. Al completar, deberías poder ingresar y enviar datos del formulario de comentarios, que luego se mostrarán en la ventana del navegador.

html

index.html

js

index.js

copy
<!DOCTYPE html>
<html>
<head>
<title>User Feedback Form</title>
<meta charset="UTF-8" />
</head>
<body>
<h1>User Feedback Form</h1>
<!-- Step 1: Create the form structure -->
<_____ onsubmit="return false">
<label for="name-field">Name:</label>
<input type="text" id="name-field" name="name" placeholder="Your name" required /><br />
<label for="comments-field">Comments:</label>
<input type="text" id="comments-field" name="comments" placeholder="Your feedback" required /><br />
<!-- Step 2: Add a submit button -->
<_____ type="_____">Submit</_____>
</_____>

<!-- The script is added only for the demonstration purpose -->
<script src="index.js"></script>
</body>
</html>

Pista

  • Paso 1: Crea la estructura del formulario usando la etiqueta <form>.
  • Paso 2: Añade un elemento <button> con type="submit" para permitir el envío de comentarios.
html

index.html

js

index.js

copy
<!DOCTYPE html>
<html>
<head>
<title>User Feedback Form</title>
<meta charset="UTF-8" />
</head>
<body>
<h1>User Feedback Form</h1>
<!-- Step 1: Create the form structure -->
<form onsubmit="return false">
<label for="name-field">Name:</label>
<input type="text" id="name-field" name="name" placeholder="Your name" required /><br />
<label for="comments-field">Comments:</label>
<input type="text" id="comments-field" name="comments" placeholder="Your feedback" required /><br />
<!-- Step 2: Add a submit button -->
<button type="submit">Submit</button>
</form>

<!-- The script is added only for the demonstration purpose -->
<script src="index.js"></script>
</body>
</html>
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 4
some-alt