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.

acceptHTMLInputElement インターフェイスのプロパティで、<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 GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
accept

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報