Topic 43 of 57 8. HTML Forms Interactive Tutorial

HTML Form Elements: Types, Uses, and Examples

12 mins read Last updated: 12 Nov 2026 15,600 views

Topic Overview & Definition

Key Question
What are the non-input form elements (<textarea>, <select>, <button>, <fieldset>, <datalist>)?
Direct Answer & Overview
Beyond standard tags, HTML provides specialized form elements: . - Unlike , default text is placed between the opening and closing tags, not in a value attribute. 2) Dropdown Menus with : The dropdown wrapper element. - : Groups related options under non-selectable category labels (e.g. Asian Countries, European Countries). 3) Autocomplete with : - Couples with an to provide autocomplete search suggestions as the user types, while still allowing custom text entries. 4) Grouping Controls with
& : -
: Draws a visual and semantic border around related controls (e.g. Shipping Address vs Billing Address). - : Serves as the caption for the fieldset, which screen readers announce when focusing any input inside. 5) The

Runnable HTML5 Code Example & Practical Implementation

index.html
HTML Editor
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Specialized Form Controls</title>
</head>
<body>
    <h2>Advanced Form Elements Showcase</h2>
    <form>
        <!-- Fieldset with Legend -->
        <fieldset style="border-radius: 8px; margin-bottom: 20px;">
            <legend><strong>Shipping Preferences</strong></legend>
            
            <!-- Select Dropdown with Optgroups -->
            <label for="shippingSpeed">Delivery Speed:</label>
            <select id="shippingSpeed" name="speed">
                <optgroup label="Standard Options">
                    <option value="ground">Ground Courier (3-5 Days)</option>
                    <option value="postal">Postal Mail (5-7 Days)</option>
                </optgroup>
                <optgroup label="Express Options">
                    <option value="next_day">Next Day Air ($19.99)</option>
                    <option value="saturday">Saturday Delivery ($29.99)</option>
                </optgroup>
            </select>
        </fieldset>

        <!-- Datalist Autocomplete -->
        <label for="citySearch">Destination City:</label>
        <input list="cities" id="citySearch" name="city" placeholder="Type city name...">
        <datalist id="cities">
            <option value="New York">
            <option value="London">
            <option value="San Francisco">
            <option value="Tokyo">
        </datalist>

        <!-- Multi-Line Textarea -->
        <p>
            <label for="specialNotes">Delivery Instructions:</label><br>
            <textarea id="specialNotes" name="notes" rows="4" style="width: 100%; max-width: 400px;"></textarea>
        </p>

        <!-- Rich Button with Icon -->
        <button type="submit" style="padding: 10px 18px; cursor: pointer;">
            Confirm &amp; Proceed &rarr;
        </button>
    </form>
</body>
</html>

Key Takeaways, Best Practices & Standards

Best Practice & Standards
Always specify type="button" on auxiliary buttons, use
and to group related inputs, and use for searchable inputs.

Common Technical & Interview Questions

Q

Q1: Why is

A1: The
Q

Q2: Why should you always specify type="button" on non-submitting buttons?

A2: By W3C specification, the default type of a
Q

Q3: How does differ from a dropdown forces the user to choose exclusively from predefined options. A provides helpful autocomplete suggestions while still allowing users to type any custom free-form text.