Image useMap attribute

Definition and usage

useMap attribute sets or returns the image's usemap attribute value.

The usemap attribute specifies the image as a client-side image map (an image map is an image with clickable areas).

the usemap attribute is associated with map element of name attribute Associated and create a relationship between the image and the map.

Instance

Example 1

Set the useMap attribute:

document.getElementById("planets").useMap = "#planetmap";

Try it yourself

Example 2

Return the usemap attribute value of the image:

var x = document.getElementById("planets").useMap;

Try it yourself

Syntax

Return the useMap attribute:

imageObject.useMap

Set the useMap attribute:

imageObject.useMap = #mapname

attribute value

value description
#mapname Hash character (#) followed by the name of the map element to be used.

Technical Details

Return Value: A string value representing the value of the usemap attribute of the image, including hash characters (#).

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Related Pages

HTML Reference Manual:HTML <img> usemap Attribute