Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Dynamically changing Image component content on AEM Form from JavaScript

Avatar

Level 4

Hi All,

Is it possible to dynamically change the content of an Image component on an AEM Form.

For example if I have an image component set to “/content/dam/Banner 1.png” and I want to dynamically change it to “/content/dam/Banner 2.png”.

Thanks,
Robert

3 Replies

Avatar

Employee Advisor

Assign a CSS class to the image . The using jquery set its attr to the new location of the file  

Avatar

Level 4

Thanks workflowuser,

How do I use jquery to set its attr to the new location of the file?

I have set the CSS class to "image1" for example.

Thanks again for your help,

Best regards,

Robert

Avatar

Level 4

Thanks workflowuser,

How do I use jquery to set its attr to the new location of the file?

I have set the CSS class to "image1" for example.

Thanks again for your help,

Best regards,

Robert