HTML <ボタン>オートフォーカス属性

❮HTML<button>タグ

オートフォーカス付きのボタン:

<button type="button" autofocus>Click Me!</button>

定義と使用法

autofocus属性はブール属性です

存在する場合、ページの読み込み時にボタンが自動的にフォーカスを取得するように指定します。


ブラウザのサポート

表の数字は、属性を完全にサポートする最初のブラウザーバージョンを示しています。

Attribute
autofocus 5.0 10.0 4.0 5.0 9.6

構文

<button type="button" autofocus>

❮HTML<button>タグ