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…
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)- A94% (29)
- B3% (1)
- D3% (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
Community Discussion
No community discussion yet for this question.