Can alt text be added to images using Javascript?

I was wondering if it is possible to add Alt Text to my product images using Javascript.

The page is a dynamic item page, I have connected the elements using JS rather than via the dataset in order to speed things up.
However I’m a bit stuck on how to add the Alt Text using a field from the database within the code.

Is this possible to do at all?

Thanks

Yep! If you’ve built it via code, you can set the Alt text using this API - https://www.wix.com/velo/reference/$w/image/alt

Thank you, much appreciated

1 Like