Hello,
I have a Quiz component that cycles through Question subcomponents. My issue is that some of the question types require some Javascript to function: https://codepen.io/jjjrmy/pen/GRpqLEZ
No matter what I’ve tried I cannot get the scripts to run as they are added to the page later when that component is called.
I found this doc but it’s not working for my use case: https://laravel-livewire.com/docs/inline-scripts/
Please note that your scripts will be run only once upon the first render of the component. If you need to run a JavaScript function later - emit the event from the component and listen to it in JavaScript as described here)
The scripts only seem to work if the component is active during first render. I have tried adding a trigger inside the nested component to run it’s own script but that also does not work.
Please Help!