title: Remove all event listeners from an element Javascript
body: <p>I am developing a shopify app and I have to build everything on a page with pure vannila javascript and faced a problem, on which at the time I can't figure out a fix.</p>
  <p>When the script is loaded, I assign event listeners like so:</p>
  <pre><code> sidebarLi.setAttribute('id', 'faq-li-' + section.id);
   let sidebarLink = document.createElement('a');
  
            sidebarLi.addEventListener('mouseover', function () {
            sidebarLi.style.backgroundColor = settings.sidebar_background_hover_color;
          });
  
          sidebarLi.addEventListener('mouseout', function () {
            sidebarLi.style.backgroundColor = settings.sidebar_inactive_background_color;
          });
  
          sidebarLink.addEventListener('mouseover', function () {
            sidebarLink.style.color = settings.sidebar_category_hover_color;
          });
  
          sidebarLink.addEventListener('mouseout', function () {
            sidebarLink.style.color = settings.sidebar_category_color;
          });
  </code></pre>
  <p>Then, later on, I need to remove them, tried using this trick:</p>
  <p>This is just an example:</p>
  <pre><code>var old_element = document.getElementById(&quot;btn&quot;);
  var new_element = old_element.cloneNode(true);
  old_element.parentNode.replaceChild(new_element, old_element);
  </code></pre>
  <p>But the element this has all the event listeners I want to remove.</p>
  <p>How to simply remove those event listeners, it could be done one by one, the code lines is not the priority for now.</p>
  <p>Later on I need to remove from one element event listeners, and add those to another one, I play with active statuses and active element should not have any active event listeners, not active elements, should have them.</p>
  <p>I get those two elements like so:</p>
  <pre><code>let activeLi = document.getElementById('faq-li-' + currentlyActiveSection.id);
  let newActiveLi = document.getElementById('faq-li-' + section.id);
  </code></pre>
  <p>The activeLi element should not have any event listeners.
  The newActiveLi element should have all the event listeners which didn't have any before.</p>
  <p>Any help will be appriciated, thanks.</p>