Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the use of the autofocus property of button in html5

Shulou Source: shulou.com Published: 2022-06-03 05:41:51 11月19日 Update

This article will explain in detail what is the use of the autofocus attribute of button in html5. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

In html 5, you can set the automatic focus to reach a control when the page is loaded, and this is the autofocus property, as follows:

The code is as follows:

Hi!

Browsers support this attribute:

Fiefox 4 magic, safari 5, chrome 6, opera, 11, opera, 10, but neither android 2.3 nor safari mobile 5-supports it.

Example

When the page loads, a button that gets focus:

The code is as follows:

Click here.

Try it yourself.

Definition and usage

The autofocus property specifies that the button should automatically gain focus when the page loads.

If you use this property, the button gets focus.

Differences between HTML 4.01 and HTML 5

The autoplay property is a new property in HTML 5.

Grammar

The code is as follows:

This is the end of this article on "what is the use of the autofocus attribute of button in html5". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Properties focus code buttons articles pages more support good practical between content instances that is differences controls articles browsers knowledge grammar Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Docker Shulou Information vpn Shulou Tech Info