title: Window keyup event - can you listen to keyup any time a page is active?
body: <p>I am trying to write something simple using vanilla js to fire a function at the time when say, a user hits the enter key. I have found some code below, but I wasn't sure how to make it work, since the function has no name. </p>
  
  <pre><code>function (event) {
    if (event.which == 13 || event.keyCode == 13) {
      alert("Wooohoo");
    }
  };
  </code></pre>
  
  <p>I saw some other solutions by changing the body tag, but I have no control over as I am writing this script for a Sharepoint page. I would think that there has to be some simple way to capture the enter key without anything selected necessarily, but I am not finding much information on it. Any guidance is appreciated!</p>