Skip to content

Courses / HTML5 Mastery: Complete Beginner to Advanced Course / HTML Select & Textarea

556 people viewed this

HTML Select & Textarea

8. Complete Example

<form action="/feedback" method="post">
  <label for="topic">Feedback Topic</label>
  <select id="topic" name="topic" required>
    <option value="">Choose a topic</option>
    <option value="course">Course Content</option>
    <option value="website">Website</option>
    <option value="support">Support</option>
  </select>

  <label for="feedback">Your Feedback</label>
  <textarea id="feedback" name="feedback" rows="5" required></textarea>

  <button type="submit">Send Feedback</button>
</form>

Common Mistakes

  • Forgetting the name attribute.
  • Using textarea with a value attribute instead of initial text between its tags.
  • Expecting datalist to restrict users to the suggestions.
  • Forgetting to label a select or textarea.
  • Assuming that submitted option values are trustworthy without server validation.

Practice Exercises

  1. Create a country dropdown with a placeholder option.
  2. Group courses into frontend and backend categories.
  3. Create a multiple-selection skills list.
  4. Build a message textarea with a maximum length.
  5. Create a datalist of programming languages.

Revision Quiz

  1. Which element creates a dropdown?
  2. Which element represents one choice inside a select?
  3. Which element groups related options?
  4. Which element is designed for longer text input?
  5. Can users normally type a custom value into an input connected to datalist?
  6. Which attribute allows multiple select options?

Answer Key and Explanations

  1. select — It provides a list of choices.
  2. option — It defines an individual choice.
  3. optgroup — It organizes related options under a label.
  4. textarea — It supports multi-line text.
  5. Yes. Datalist suggestions do not normally restrict input to listed values.
  6. multiple — It enables multiple selections.

Rate this course

5.0 · 1 rating

Stars show on this course. Your written note stays private.

Your stars