title: How to fix JS addEventList in Elementor WordPress?
body: <p>When I'm trying to add script to Elementor via &quot;HTML Edit&quot; element from Elementor, or in any field of Elementor when edit it's HTML, addEventListener doesn't work out of admin. So if you load edited page as admin, it's work, if you join as a guest sends error: &quot;Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener')&quot;. All elements are available, tried everything, doesn't work. Any options to add script?</p>
  <pre><code> function count() {
      let percent = Math.round(Number(document.querySelectorAll(&quot;.form-control&quot;)[2].value)/100*35+Number(document.querySelectorAll(&quot;.form-control&quot;)[2].value));
      document.querySelectorAll(&quot;.form-control&quot;)[3].value = percent ;
      document.querySelectorAll(&quot;.form-control&quot;)[4].value = Math.round(percent*1.35);
  }
  document.querySelectorAll(&quot;.form-control&quot;)[2].addEventListener(&quot;input&quot;, count);
  </code></pre>