HTML <input>オートコンプリート属性
例
オートコンプリートがオン(および1つの入力フィールドに対してオフ)のHTMLフォーム:
<form action="/action_page.php" autocomplete="on">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<label
for="email">Email:</label>
<input type="email" id="email"
name="email" autocomplete="off"><br><br>
<input type="submit">
</form>
定義と使用法
このautocomplete
属性は、入力フィールドでオートコンプリートを有効にするかどうかを指定します。
オートコンプリートを使用すると、ブラウザで値を予測できます。ユーザーがフィールドの入力を開始すると、ブラウザーは、以前に入力された値に基づいて、フィールドに入力するためのオプションを表示する必要があります。
注:このautocomplete
属性は、テキスト、検索、URL、電話、電子メール、パスワード、日付ピッカー、範囲、および色の入力タイプで機能します。
ブラウザのサポート
表の数字は、属性を完全にサポートする最初のブラウザーバージョンを示しています。
Attribute | |||||
---|---|---|---|---|---|
autocomplete | 17.0 | 6.0 | 2.0 | 5.1 | 10.0 |
ヒント:一部のブラウザでは、これを機能させるためにオートコンプリート機能をアクティブにする必要がある場合があります(ブラウザのメニューの[設定]の下を見てください)。
構文
<input autocomplete="on|off">
属性値
Value | Description |
---|---|
on | Default. Specifies that autocomplete is on (enabled) |
off | Specifies that autocomplete is off (disabled) |
❮HTML<input>タグ