HTML DOM
The capture property of the HTMLInputElement interface reflects the input element's capture attribute. Only relevant to the <input> of type file, the property and attribute specify whether, a new file should be captured from a user-facing (user) or outward facing (environment) camera or microphone. The type of file is defined the accept attribute. If the attribute is not explicitly set, the capture property is an empty string.
Value
A string; generally either user or environment, or an empty string ("").
Example
const inputElement = document.querySelector("avatar");
console.log(inputElement.capture); // the current value of the capture attribute
inputElement.capture = "user"; // sets the capture value
Specifications
Browser compatibility
See also
- HTMLInputElement.type
- HTMLInputElement.multiple
- HTMLInputElement.accept
- HTMLInputElement.files
- File type specifiers
- Using files from web applications
- File API
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
