HTMLInputElement: accept プロパティ
        
        
          
                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月.
accept は HTMLInputElement インターフェイスのプロパティで、<input> 要素の accept 属性を反映し、一般にカンマで区切られた固有ファイル型指定子のリストで、<input> の file 型に期待されるファイル型のヒントを提供します。この属性が明示的に設定されていない場合、accept 属性は空文字列になります。
値
要素の accept 値を表す文字列、または accept が明示的に設定されていない場合は空文字列。
例
js
const inputElement = document.querySelector("#time");
console.log(inputElement.accept); // accept 属性の現在の値
inputElement.accept = ".doc,.docx,.xml,application/msword"; // accept 値を設定
仕様書
| Specification | 
|---|
| HTML> # dom-input-accept> | 
ブラウザーの互換性
Loading…