Designer API
Control the Webflow Designer
element.setAltText(altText)
Set the Alt Text for an Image element on the canvas.
1element.setAltText(altText: string | null): Promise<null>
Promise<null>
null
A Promise that resolves to null
1// Get Selected Element2const el = await webflow.getSelectedElement()34// Check element type5if (el?.type === 'Image') {6 // Set alt text7 await el.setAltText('Descriptive alternative text for this image')89 // Verify by getting the alt text10 const alt = await el.getAltText()11 console.log(alt)12} else {13 console.error('Please select an image element')14 await webflow.notify({15 type: 'Error',16 message: 'Please select an Image Element',17 })18}