THE WORLD'S LARGEST WEB DEVELOPER SITE

Area alt Property

❮ Area Object

Example

Get the alternate text of a specific area in an image-map:

var x = document.getElementById("venus").alt;

The result of x will be:

A beautiful planet
Try it Yourself »

Definition and Usage

The alt property sets or returns the value of the alt attribute of an area.

The required alt attribute specifies an alternate text for an area, if the image cannot be displayed.


Browser Support

Property
alt Yes Yes Yes Yes Yes

Syntax

Return the alt property:

areaObject.alt

Set the alt property:

areaObject.alt=text

Property Values

Value Description
text The alternate text for the area

Technical Details

Return Value: A String, representing an alternate text for the area

More Examples

Example

Change the alternate text for a specific area in an image-map:

document.getElementById("venus").alt = "The planet Venus";
Try it Yourself »

Related Pages

HTML reference: HTML <area> alt attribute


❮ Area Object