Input types, online

Six activities your students do on their own devices. See who's finished, and their scores.

Input types in one minute

What students need to know

type="email" tells the browser to validate the format as an email address. Changing the type value changes the entire field behaviour. type="number" adds a numeric stepper to the field and rejects non-numeric input on submission.

type="password" hides the characters for security. 'secret' is not a valid input type. type="checkbox" renders a tick-box. When checked and submitted, the name/value pair is included in the form data.

Mistakes students make

  • The type value must be lowercase. 'Email' should be written as 'email': type="email".
  • The type attribute value is missing its closing double quote. It should be type="number" min="1" max="10".
  • The type attribute value must be in double quotes: type="password", not type=password without quotes.
  • 'telephone' is not a valid input type. The correct type for phone numbers is 'tel': type="tel".

Discover other journeys with this module

What students will learn in this module

Every question in Module 28

Quick questions

  1. Which input type masks the characters as the user types?ApasswordBsecret
  2. Which input type is used for phone numbers?AtelBphone
  3. True or false: type="number" accepts letters as well as digits.AFalseBTrue
  4. Which type creates a tick-box control?AcheckmarkBcheckbox
  5. True or false: type attribute values are case-sensitive and must be lowercase.AFalseBTrue

Key terms

Students type the meaning of:

  • type

Match the pairs

<input type="password" name="pass">Match it to what it does
<input type="checkbox" name="agree">Match it to what it does
The type attribute controls what kind of data field <input> createsMatch it to what it does
type="number" restricts the field to numeric values and shows a stepper controlMatch it to what it does
<input type="telephone" name="t">Match it to what it does
<input type="Email" name="e">Match it to what it does

Fill in the blanks

  1. <input type="___" name="e">

    Hint: Type the input type value used for email address fields

  2. <input type="___" name="pass">

    Hint: Type the input type value that masks characters as the user types

  3. <input type="___" name="age">

    Hint: Type the input type value that accepts only numeric entries

  4. <input type="___" name="agree">

    Hint: Type the input type value that creates a tick-box control

  5. <input type="___" name="phone">

    Hint: Type the input type value used for telephone number fields

Spot the error

Question 1

A<input type="Email" name="email">B<input type="text" name="user">C<button>Submit</button>

Question 2

A<form>B  <input type="number min="1" max="10">C  <button>Go</button>D</form>

Question 3

A<form>B  <input type="text" name="user">C  <input type=password name="pass">D  <button>Login</button>E</form>

Question 4

A<form>B  <input type="text" name="q">C  <input type="email" name="e">D  <input type="telephone" name="t">E</form>

Question 5

A<form>B  <input type="text" name="name">C  <input type="email" name="email">D  <input type="number" name="age">E  <input type="checkmark" name="agree">F</form>