My script is not executed again after changes

I have a REACT script that i have inserted in a webpanel.
As the script is loaded before the div element exists, i added an eventlistener as:
document.addEventListener('DOMContentLoaded', function ()
The problem is that after i transition the issue, my script is not executed again
Any suggestion?