title: jquery get id of table closest to key press
body: <p>I am creating tables on button click and that works great. I then have have a hotkey to add extra rows to those tables. I need to get the parent id of the table where the cursor is but it keeps giving me undefined. I can get the parent div id ok but when I put table in it gives me undefined. Any help would be appreciated</p>
  
  <pre><code>$(document).ready(function() {
      $("#divNarrative1").keypress(function(e){    
          alert(e.target.id);
          var msgId = $( this ).closest( 'table' ).attr( 'id' );
          alert(msgId);
      });
  
  });
  </code></pre>