Which HTML attribute automatically focuses a form control when the page loads?

Prepare for the CIW Advanced HTML5 and CSS3 Specialist Exam. Study effectively with comprehensive materials, flashcards, and engaging multiple-choice questions. Enhance your expertise and get ready to succeed!

Multiple Choice

Which HTML attribute automatically focuses a form control when the page loads?

Explanation:
Autofocus makes a form control receive focus automatically when the page loads. By placing the autofocus attribute on an input, textarea, select, or button, that element is ready for typing or interaction immediately, so the user can start without clicking. The attribute is a boolean—its presence activates it. If more than one element has autofocus, browsers typically focus the first one, though behavior can vary. The other options don’t fit: Required enforces that the field must be filled before submitting, Placeholder shows sample text inside the field, and Disabled prevents interaction and removes focusability.

Autofocus makes a form control receive focus automatically when the page loads. By placing the autofocus attribute on an input, textarea, select, or button, that element is ready for typing or interaction immediately, so the user can start without clicking. The attribute is a boolean—its presence activates it. If more than one element has autofocus, browsers typically focus the first one, though behavior can vary. The other options don’t fit: Required enforces that the field must be filled before submitting, Placeholder shows sample text inside the field, and Disabled prevents interaction and removes focusability.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy