Skip to main content

HTML Input Attributes — exercises and bug fixes

5 hands-on exercises and 5 find-the-bug challenges for the HTML Input Attributes lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.

Exercises(5)

  1. 1

    Add a placeholder

    easy10 min

    Add placeholder text to an input.

  2. 2

    Make a field required

    easy10 min

    Mark the input as required.

  3. 3

    Set a default value

    easy10 min

    Give the input a default value of 1.

  4. 4

    Make a field read-only

    easy10 min

    Mark the input as readonly.

  5. 5

    Limit the length

    medium10 min

    Restrict the input to 10 characters.

Find the bug(5)

  1. 1

    Fix the placeholder used as a label

    easy8 min

    A placeholder disappears on typing — add a real label.

  2. 2

    Fix the misspelled required

    easy8 min

    "require" is not a valid attribute.

  3. 3

    Fix the default set as text

    easy8 min

    Default content goes in the value attribute, not between tags.

  4. 4

    Fix disabled used instead of readonly

    easy8 min

    A disabled field is not submitted; readonly is.

  5. 5

    Fix the wrong length attribute

    easy8 min

    The attribute is maxlength, not maxsize.

Ready to write the code?

The editor, the automatic checks and the worked solutions open up with an account.

Open the workspace