title: Using .keydown() to return div id?
body: <p>I'm not really sure if I'm phrasing this correctly, but what I'm trying to do is have a function return a <code>div</code>'s id on a <code>keydown</code> event.</p>
  
  <p>Say my HTML is:</p>
  
  <pre><code>&lt;div class="pad" id="snare" data-key="97"&gt;&lt;/div&gt;
  &lt;div class="pad" id="kick" data-key="98"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Essentially I want my JS to do something like this:</p>
  
  <pre><code>function handlekeydown(e) {
      console.log("data-key: " + e.keyCode);
      if (e.keycode == $(".pad").data("key")) {
          return this.id
      }
  }
  </code></pre>
  
  <p>I could write a <code>switch</code> statement with each <code>keycode</code> returning a variable with the same name as the id, but that would defeat the purpose of having it in my HTML.</p>
  
  <p>How would I write a function to search a <code>div</code> for a <code>data-key</code> that would match the <code>keycode</code> and then return its id?</p>