Load Dynamic JavaScript Based on Radiogroup | Community
Skip to main content
MktgCloudUser
Level 4
Oct 10, 2018 5:00 AM UTC
Solved

Load Dynamic JavaScript Based on Radiogroup

Hello,

I have a component with a radiogroup with three options corresponding to a JS library.  My JS files are under the component root in js.txt as:

/js/library1.js

/js/library.2js

/js/library3.js

When the end-user selects one of the radiogroup options, would it be possible to only load the selected JS library and prevent the other two from being merged into the clientlibs?  If this isn't possible with my current setup, what is a better way of dynamically loading only the required JS libraries based on a end-user selection?

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Oct 10, 2018 7:46 AM UTC

There is no OOTB functionality to achieve this.

But you can do with onChange event of radio you can load javascript file without creating as clientlibs.

https://stackoverflow.com/questions/5235321/how-do-i-load-a-javascript-file-dynamically

Arun Patidar

1 reply

arunpatidar
arunpatidarAccepted solution
New Participant
Oct 10, 2018 7:46 AM UTC

There is no OOTB functionality to achieve this.

But you can do with onChange event of radio you can load javascript file without creating as clientlibs.

https://stackoverflow.com/questions/5235321/how-do-i-load-a-javascript-file-dynamically

Translate
Arun Patidar