HTMLInputElement: alt property - Web APIs | MDN
Value
A string.
Examples
js
const inputElement = document.getElementById("imageButton");
console.log(inputElement.alt);
inputElement.alt = "A much better description";
Specifications
| Specification |
|---|
| HTML # dom-input-alt |
Browser compatibility
See also
HTMLImageElement.altHTMLButtonElement<button><input><img>- Good alt text, bad alt text — Making your content perceivable on WCAG.com (2021)
- An alt Decision Tree on W3C Web Accessibility Initiative (WAI)