Dynamically changing Image component content on AEM Form from JavaScript

Avatar

Avatar
Validate 10
Level 3
RobertBailey201
Level 3

Likes

11 likes

Total Posts

53 posts

Correct reply

5 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 3
RobertBailey201
Level 3

Likes

11 likes

Total Posts

53 posts

Correct reply

5 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
RobertBailey201
Level 3

02-09-2016

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

Replies

Avatar

Avatar
Ignite 5
Employee
workflowuser
Employee

Likes

143 likes

Total Posts

446 posts

Correct reply

70 solutions
Top badges earned
Ignite 5
Ignite 3
Ignite 1
Give Back 50
Give Back 5
View profile

Avatar
Ignite 5
Employee
workflowuser
Employee

Likes

143 likes

Total Posts

446 posts

Correct reply

70 solutions
Top badges earned
Ignite 5
Ignite 3
Ignite 1
Give Back 50
Give Back 5
View profile
workflowuser
Employee

02-09-2016

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

Avatar

Avatar
Validate 10
Level 3
RobertBailey201
Level 3

Likes

11 likes

Total Posts

53 posts

Correct reply

5 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 3
RobertBailey201
Level 3

Likes

11 likes

Total Posts

53 posts

Correct reply

5 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
RobertBailey201
Level 3

02-09-2016

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

Avatar
Validate 10
Level 3
RobertBailey201
Level 3

Likes

11 likes

Total Posts

53 posts

Correct reply

5 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 3
RobertBailey201
Level 3

Likes

11 likes

Total Posts

53 posts

Correct reply

5 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
RobertBailey201
Level 3

08-09-2016

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