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 July 2015.
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 |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
accept |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.