Javascript displaying adjustable chart on first question, but not subsequent questions? | XM Community
Solved

Javascript displaying adjustable chart on first question, but not subsequent questions?

  • 12 March 2019
  • 2 replies
  • 8 views

Badge
Hi all,

I have an issue displaying a chart that is drawn in javascript- it works on the first question block, but not in subsequent blocks & questions in preview mode, and via anonymous link. The charts display fine when the questions/ blocks are previewed in isolation within the editor. I've attached the qsf- does anybody have experience with this issue?

Many thanks!
icon

Best answer by NiC 14 March 2019, 10:30

View original

2 replies

Userlevel 7
Badge +27
Hi @cjohnburke,

So the issue you are facing here is due to duplicate id's
Adding the following code in addOnUnload function for every question you have the chart code on should solve your problem:

`jQuery("#myChart").remove(); `

Attached the updated qsf i tried the code and charts are working on
Badge
Thank you @NiC ! THis worked. The other thing that worked was disabling page transitions in the look and feel editor.

Leave a Reply