title: How to detect if Enter Key was pressed within a DIV using jquery?
body: <p>I have successfully hooked the EnterKey event at the document level as following:</p>
  
  <pre><code>    $(document).keypress(function (e) {
          if (e.which == 13) {
              alert('You pressed enter!');
          }
      });
  </code></pre>
  
  <p>But, I am unable to hook the EnterKey event on a Div with id "myDiv".</p>
  
  <pre><code>&lt;div id="myDiv"&gt;&lt;/div&gt;
  
  $("#myDiv").keypress(function (e) {
       if (e.which == 13) {
           alert('You pressed enter!');
       } 
   });
  </code></pre>
  
  <p>Is it possible to detect an EnterKey press within a Div? Actually, the Div contains some input/select controls which are used to filter the content of a Grid. I want to hook the EnterKey event so that when the EnterKey is pressed I can filter the Grid.</p>
  
  <p><strong>EDIT:</strong> 
  Please note that I have inputs within the div(I've intentionally not shown them here). I don't want to hook the event manually for each of the input control within the Div. Also, I am assuming that when user presses EnterKey at least one input control shall have focus.</p>