nerdexam
CIW

1D0-720 · Question #101

What is the role of the placeholder attribute in HTML5 form elements?

The correct answer is B. To provide a default value that appears in the form element. Option B is correct because the placeholder attribute displays hint text inside a form field (e.g., "Enter your email") that disappears once the user starts typing - it's a short description of the expected input, not a persisted value. Option A is wrong because tooltips are…

Advanced HTML5 Features

Question

What is the role of the placeholder attribute in HTML5 form elements?

Options

  • ATo create a tooltip for the form element.
  • BTo provide a default value that appears in the form element.
  • CTo define a CSS class for the form element.
  • DTo specify a label for the form element.

How the community answered

(56 responses)
  • A
    2% (1)
  • B
    89% (50)
  • C
    4% (2)
  • D
    5% (3)

Explanation

Option B is correct because the placeholder attribute displays hint text inside a form field (e.g., "Enter your email") that disappears once the user starts typing - it's a short description of the expected input, not a persisted value. Option A is wrong because tooltips are created with the title attribute, not placeholder. Option C is incorrect since CSS classes are assigned via the class attribute. Option D is a common mix-up - labels are created with the <label> element and its for attribute, which is a separate, accessible mechanism for describing a field.

Memory tip: Think of a placeholder as a "ghost" inside the input box - it shows you what belongs there, then vanishes when you take over. If it stuck around after you typed, it would be a value, not a placeholder.

Topics

#placeholder attribute#HTML5 forms#form input attributes#user interface hints

Community Discussion

9
Hiroshi T.Hiroshi T.Mar 23, 2026

B is correct. The placeholder attribute displays hint text inside a form field that disappears when the user starts typing, giving a visual cue about the expected input, not a persisted default value like the value attribute provides. The HTML5 spec (section 4.10.18.5) distinguishes placeholder from label, tooltip (title), and CSS class (class), so the other options describe entirely different mechanisms.

16
Fatima Z.Fatima Z.Mar 26, 2026

Hiroshi nailed it, and here is the sticky hook to cement it: think PLACEHOLDER equals PHANTOM TEXT, it haunts the field until you type, while VALUE is the actual ghost that stays permanently, so the spec is really just saying a ghost is not a resident.

0
Carlos M.Carlos M.Apr 4, 2026

B is right, placeholder shows hint text inside the input, not a real value.

4
Fatima Z.Fatima Z.Apr 20, 2026

B nails it, placeholder shows hint text that vanishes once you start typing.

2
Hiroshi T.Hiroshi T.Apr 21, 2026

Fatima is right that the disappearing hint is the expected behavior, but keep in mind that some accessibility guidelines (WCAG 2.5.3 and the supporting techniques) recommend pairing the placeholder with a persistent visible label so users do not lose context mid-entry if they pause to verify what the field requires.

0
Brenda K.Brenda K.Apr 10, 2026

I almost picked D because labels and placeholders both describe what goes in a field, but then I remembered that placeholder text sits inside the input box itself and disappears when you start typing, which is exactly what a default value does, so B is the one. Watch your clock on this one, it is a quick 20-second read and move on, do not let the wording on D pull you into a two-minute debate with yourself.

1
Carlos M.Carlos M.Apr 11, 2026

Solid reasoning on B, but just to sharpen it, placeholder text and a default value are not quite the same thing, since placeholder disappears on focus or first keystroke while a default value sits there until you actively clear it, which is a distinction that shows up on accessibility questions too so worth keeping in the back of your head.

0
Samuel O.Samuel O.Apr 24, 2026

B is right, though I'd call it hint text, not a default value since it vanishes on input.

1
Fatima Z.Fatima Z.Apr 26, 2026

Lock it in with PAID: Placeholder And Input Disappear, which is exactly why "hint" fits and "default" falls flat, since a true default sticks around until the user overwrites it.

0
Full 1D0-720 Practice