THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Area alt Property

Area Object Reference 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

Internet Explorer Firefox Opera Google Chrome Safari

The alt property is supported in all major browsers.


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 Reference Area Object