Text inputs (input), online

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

Text inputs (input) in one minute

What students need to know

name="email" means the entered value is sent as email=entered_value. Without name, the value is not submitted. <input> ends after its attributes and the closing >. There is no </input> closing tag in HTML.

type specifies the input field type - text, email, password, etc. 'kind' is not a valid HTML attribute. name is the key used when form data is sent to the server. The visible label is a separate <label> element.

Mistakes students make

  • HTML tag names must be lowercase. <INPUT> should be written as <input>.
  • The type attribute must use = and double quotes: type="text", not type text without equals sign and quotes.
  • Password inputs should have a name attribute so the value is included in form data. Add name="pass" or similar.
  • Attribute values must be in double quotes: name="email", not name=email without quotes.
PREVIOUS · MODULE 26The form element
YOU ARE HERE · MODULE 27Text inputs (input)
NEXT · MODULE 28Input types

Discover other journeys with this module

What students will learn in this module

Every question in Module 27

Quick questions

  1. Which attribute on <input> determines what kind of field it creates?AkindBtype
  2. True or false: an <input> element requires a closing </input> tag.ATrueBFalse
  3. What does the name attribute do on an input?AIdentifies the value when the form is submittedBSets the visible label above the field
  4. True or false: <INPUT> with capital letters is valid HTML.AFalseBTrue
  5. What does the placeholder attribute do?AShows hint text inside the field before the user typesBSets the default submitted value of the field

Key terms

Students type the meaning of:

  • name

Match the pairs

<input type="text" name="username">Match it to what it does
<input type="text" name="q"
  placeholder="Search.">
Match it to what it does
The name attribute identifies the input's value when the form is submittedMatch it to what it does
<input> is self-closing - it has no content and must not have a closing </input> tagMatch it to what it does
<INPUT type="text" name="q">Match it to what it does
<input type="text">Match it to what it does

Fill in the blanks

  1. <___ type="text" name="username">

    Hint: Type the self-closing element name used to create a text field

  2. <input ___="text" name="city">

    Hint: Type the attribute name that specifies what kind of input field this is

  3. <input type="text" ___="email">

    Hint: Type the attribute name that identifies this input when the form is submitted

  4. <input type="text" name="q" ___="Search">

    Hint: Type the attribute name that shows hint text inside the input before the user types

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

    Hint: Type the type value that creates a single-line text field

Spot the error

Question 1

A<INPUT type="text" name="q">B<input type="email" name="email">C<button>Search</button>

Question 2

A<form>B  <input type text name="city">C  <button>Submit</button>D</form>

Question 3

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

Question 4

A<form>B  <input type="text" name="first">C  <input type="text" name="last">D  <input type="text" name=email>E</form>

Question 5

A<form>B  <input type="text" name="q">C  <input type="text" name="tag">D  <input type="text" name="filter">E  <input type=text name="sort">