autofocus Attribute of Form Field: HTML5

Quick video to illustrate autofocus attribute of HTML5 form fields.

Here we take 3 input fields, and one field is set with autofocus attribute.

HTML file
index.html

< !DOCTYPE HTML>


Form, Autofocus: HTML5




In above case, the third input field gets the autofocus.

autofocus Attribute of Form Field: HTML5



YouTube Link: https://www.youtube.com/watch?v=E1L5-5ZhZaE [Watch the Video In Full Screen.]



Note: You can also apply autofocus to the buttons, so that user can directly hit OK or CANCEL by pressing Enter key of their keyboard! – whichever is most desired.