HTMLInputElement: capture property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Thecapture property of theHTMLInputElement interface reflects the<input> element'scapture attribute. Only relevant to the<input> of typefile, 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 theaccept attribute. If the attribute is not explicitly set, thecapture property is an empty string.
In this article
Value
A string; generally eitheruser orenvironment, or an empty string ("").
Example
js
const inputElement = document.querySelector("avatar");console.log(inputElement.capture); // the current value of the capture attributeinputElement.capture = "user"; // sets the capture valueSpecifications
| Specification |
|---|
| HTML Media Capture> # dom-htmlinputelement-capture> |