HTMLImageElement: alt property - Web APIs | MDN

Value

A string.

Examples

Setting the alt attribute

js

const img = new Image();
img.src = "example.png";
img.alt = "An example picture";

Specifications

Specification
HTML
# dom-img-alt

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.