Remove added event listener
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4402287/javascript-remove-event-listener">JavaScript: remove event listener</a>  </p>
</blockquote>



<p>I am adding some listener in my html page using the following javascript. But i need to remove the listener once that element is clicked. Any idea on this would be greatly appreciated.</p>

<p>Here is the JavaScript code for the listener,</p>

<pre><code>document.addEventListener('mousemove',function(e){
    var elem = e.target || e.srcElement;
    if (prevElement!= null) {prevElement.classList.remove("className");}
    elem.classList.add("className");
    prevElement = elem;
},true);
</code></pre>
