How do I recognize when somebody has pressed a key?

Use the jquery .on function.  The jquery.on function has the following
format

The webpage, AKA the DOM, is a lot like a circus. Ever element is a circus tent. At the circus, lots of interesting things happen.  These are called events. (I imagine a fruity circus announcer announcing the main event when I hear the word events.)  When you hear about an event happening inside your circus tent, you usually take an action, like, for example, screaming your head off in excitement.

1. The circus tent you are looking at $("#my_tent")
2. The event you are listening for ("keyup")
3. The action you take when you hear the event you are listening to. (function(){
  return "get really exicted"
})