HTMLInputElement: type プロパティ
        
        
          
                Baseline
                
                  Widely available
                
                
              
        
        
        
          
                
              
                
              
                
              
        
        
      
      This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
type は HTMLInputElement インターフェイスのプロパティで、 <input> 要素を入力する際に許可されるデータの型(数値、日付、メールアドレスなど)を示します。ブラウザーは適切なウィジェットを選択し、ユーザーが有効な値を入力できるように振る舞います。
値
型を表す文字列です。
取りうる値の一覧はこの属性の入力型の節にあります。
例
>HTML
html
<input id="input1" type="date" />
JavaScript
js
const inputElement = document.querySelector("#input1");
console.log(inputElement.type); // Output: "date"
仕様書
| Specification | 
|---|
| HTML> # dom-input-type> | 
ブラウザーの互換性
Loading…
関連情報
- HTMLTextAreaElement.typeプロパティ
- HTMLButtonElement.typeプロパティ