title: How to remove previous eventListener?
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var keyPress = function(){
      x = document.querySelector(".textt");
      x.addEventListener("keyup", function(event){
         var keyp = document.querySelector(".textt").value;
         console.log(event);
         document.getElementById("submit").addEventListener("click", function(){
             create(event);
             x.value = "";
          })
      })
  }
      
  var create = function(event){
      var out = document.querySelector(".output");
      var displa = document.createElement('li');
      displa.textContent =  "The key Code for " + event.key + " is: " + event.keyCode;
      out.appendChild(displa);
  }
      
  function clearAll(){
      location.reload();
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
     &lt;title&gt; ASCI &lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;p&gt; Enter any Character &lt;/p&gt;
     &lt;form&gt;
         &lt;input class="textt" type="text" id = "inp" onkeypress="keyPress()"&gt;
      &lt;/form&gt;
      &lt;button id="tt" onclick="clearAll()"&gt;Clear&lt;/button&gt;
      &lt;button id="submit"&gt;Submit&lt;/button&gt;
          
      &lt;ul class="output"&gt;
      &lt;/ul&gt; 
      &lt;script type="text/javascript" src="script.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>**Output1: First time when I press a key I'm able to get keycode
  The key Code for a is: 65
   **</p>
  
  <p>**Output2: Second time I press key I'm able to get keycodes but it also gives me output for previous key as well as the 2 times the for the new key pressed
  The key Code for a is: 65
  The key Code for a is: 65
  The key Code for b is: 66
  The key Code for b is: 66
   **
  Can someone help me to resolve this? I only want the output for the new key pressed not previous ones's.</p>