In html5, you can set the automatic focus to reach a certain control when the page is loaded. This is the autofocus attribute. Next, let's take a look at it in html 5, you can set the automatic focus to reach a control when the page is loaded. This is the autofocus attribute, as shown below:
The Code is as follows:
Hi!
The browser supports the following attributes::
Fiefox 4 +, safari 5 +, chrome 6 +, opera 11 +, ie 10, not supported by android 2.3 and safari mobile 5
Instance
When a page is loaded, a button with the focus will be obtained:
The Code is as follows:
Click here
Try it yourself
Definition and usage
The autofocus attribute specifies that when a page is loaded, the button should automatically obtain the focus.
If this attribute is used, the button gets the focus.
Differences between HTML 4.01 and HTML 5
The autoplay attribute is a new attribute in HTML 5.
Syntax
The Code is as follows: