Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Building a Web Form | Tables and Forms
HTML Essentials

book
Challenge: Building a Web Form

Task

Create an HTML form to gather user feedback. Prompt users to input their names and comments. In this exercise, we'll include the JavaScript script for demonstration purposes only. Upon completion, you should be able to input and submit feedback form data, which will then be displayed in the browser window.

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>

Hint

  • Step 1: Create the form structure using the <form> tag.
  • Step 2: Add a <button> element with type="submit" to allow feedback submission.
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>

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 4
some-alt