freecoding.school100% FREE · NO SIGNUP
Input HarborISSUE #7 of 46

input types · color · search · hidden

FormaVSCaptain Invalid Input
Forma saysSpecialized input types — color, search, tel, hidden — round out the set for niche needs.

type="color" opens a color picker and returns a hex value. type="search" is a text box styled as search (with a clear button in some browsers). type="tel" shows a phone keypad on mobile. type="hidden" carries a value the user never sees — useful for tokens and ids.

None of these are essential, but each adds polish or solves a specific problem more cleanly than a plain text box.

Power-ups you unlock

Captain Invalid Input attacks — common mistakes

Boss battleAdd a color picker and a hidden input carrying a fake token. Submit and note the hidden value travels along.

Example code

<!doctype html>
<html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:sans-serif;padding:20px">
  <form action="#">
    <p><label>pick <input type="color" value="#b388ff"></label></p>
    <p><label>find <input type="search" placeholder="search…"></label></p>
    <input type="hidden" name="token" value="abc123">
    <button>submit</button>
  </form>
</body></html>
▶ Open the interactive comic issue
‹ Input Types · Checkbox · Radio · FileInput Attributes · Required · Placeholder · Pattern ›