nerdexam
CIW

1D0-720 · Question #97

Which HTML5 attribute is used for validating that an input field is not left empty?

The correct answer is A. required. The required attribute is a boolean HTML5 attribute that prevents form submission if the input field is empty, making it the direct tool for "not left empty" validation. pattern validates input against a regex expression but doesn't enforce non-empty on its own - an empty field…

Advanced HTML5 Features

Question

Which HTML5 attribute is used for validating that an input field is not left empty?

Options

  • Arequired
  • Bpattern
  • Cmaxlength
  • Dplaceholder

How the community answered

(31 responses)
  • A
    94% (29)
  • B
    3% (1)
  • D
    3% (1)

Explanation

The required attribute is a boolean HTML5 attribute that prevents form submission if the input field is empty, making it the direct tool for "not left empty" validation. pattern validates input against a regex expression but doesn't enforce non-empty on its own - an empty field can still pass if required isn't present. maxlength only limits the maximum number of characters a user can type, saying nothing about whether the field must be filled. placeholder is purely cosmetic - it shows hint text inside the field that disappears on focus, with zero validation behavior.

Memory tip: Think "Required = Refuses to submit empty" - the word itself tells you what it does.

Topics

#HTML5 validation#required attribute#form inputs#client-side validation

Community Discussion

No community discussion yet for this question.

Full 1D0-720 Practice