title: Remove EventListener in JavaScript after event occurred?
body: <p>There are 24 div-objects waiting/listening for a mouse-click. After click on one div-object, I want to remove the <code>EventListener</code> from all 24 div-objects.</p>
  
  <pre><code>for (var i=1;i&lt;=24;i++){
      document.getElementById('div'+i).addEventListener('click',function(event){
          for (var z=1;z&lt;=24;z++){
              document.getElementById('div'+z).removeEventListener()//Problem lies here
          }
  
          //Some other code to be run after mouseclick
  
          },false);
  
  }
  </code></pre>
  
  <p>The problem is that the <code>removeEventListener</code> is nested in <code>addEventListener</code> and I need to define type, listener, caption as attributes to the <code>removeEventListener</code> method. And I think it is impossible to define the listener because of nesting.</p>
  
  <p>I also tried to define a function name, but it didn't worked:</p>
  
  <pre><code>for (var i=1;i&lt;=24;i++){
      document.getElementById('div'+i).addEventListener('click',function helpme(event){
          for (var z=1;z&lt;=24;z++){
              document.getElementById('div'+z).removeEventListener('click',helpme,false);
          }
  
          //Some other code to be run after mouseclick
  
          },false);
  
  }
  </code></pre>