HTMLInputElement: accept property - Web APIs | MDN

Value

A string representing the element's accept value or an empty string if no accept is explicitly set.

Example

js

const inputElement = document.querySelector("#time");
console.log(inputElement.accept); // the current value of the accept attribute
inputElement.accept = ".doc,.docx,.xml,application/msword"; // sets the accept value

Specifications

Specification
HTML
# dom-input-accept

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.