Search.../

alt

Sets or gets an image's alt text.

Description

An image's alternative text is typically a relatively short phrase that describes what the image depicts.

The alternative text is used:

  • If the browser cannot display the image.
  • If the user is utilizing a screen reader.
  • By search engines to understand what images are on your site.

Type:

stringRead & Write, default value is An empty string

Was this helpful?

Get the image's alt text

Copy Code
1let altText = $w("#myImage").alt; // "Alt text"
Set the image's alt text

Copy Code
1$w("#myImage").alt = "Alt text";