since the survey is shown question by question,
Of course it doesn't work.
Always remember: javascript runs on the participant's machine. How can it write something into a question that is not loaded?
Therefore we always recommend to show "group by group" but put only one question into each group.
This gives you the flexibility to display one question per page, but at the same time you can use these workarounds that require several questions in one group.
For question type array,
In my post I showed only "single question" and "multiple question", no array.
But you may try to adapt it.
If you investigate the page with the webdevelopment tool of your browser (F12) you see
that in arrays there is a row (tr) and a answers-list.
The rest is equal.
Joffm