Add placeholder text to an input.
Acceptance criteria
- 1.Add placeholder text to an input.
HTML Tutorial · HTML Forms
These 10 tasks go with the HTML Input Attributes chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “HTML elements support a wide range of attributes that define their behavior, appearance, and interaction with users. These attributes help control data entry, validation, accessibility, and styling within web forms.” .
1.Add a placeholderexercise · easy · 10 min
Add placeholder text to an input.
Passes when: Add placeholder text to an input.
2.Make a field requiredexercise · easy · 10 min · practice plan
Mark the input as required.
Passes when: Mark the input as required.
3.Set a default valueexercise · easy · 10 min · practice plan
Give the input a default value of 1.
Passes when: Give the input a default value of 1.
4.Make a field read-onlyexercise · easy · 10 min · practice plan
Mark the input as readonly.
Passes when: Mark the input as readonly.
5.Limit the lengthexercise · medium · 10 min · practice plan
Restrict the input to 10 characters.
Passes when: Restrict the input to 10 characters.
6.Fix the placeholder used as a labelbug fix · easy · 8 min
A placeholder disappears on typing — add a real label.
Passes when: A placeholder disappears on typing — add a real label.
7.Fix the misspelled requiredbug fix · easy · 8 min · practice plan
"require" is not a valid attribute.
Passes when: "require" is not a valid attribute.
8.Fix the default set as textbug fix · easy · 8 min · practice plan
Default content goes in the value attribute, not between tags.
Passes when: Default content goes in the value attribute, not between tags.
9.Fix disabled used instead of readonlybug fix · easy · 8 min · practice plan
A disabled field is not submitted; readonly is.
Passes when: A disabled field is not submitted; readonly is.
10.Fix the wrong length attributebug fix · easy · 8 min · practice plan
The attribute is maxlength, not maxsize.
Passes when: The attribute is maxlength, not maxsize.
Between them these tasks cover placeholder, required, value and readonly.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.