title: jQuery keypress event for a form that's a resulf of an ajax call
body: <p>Clicking a link in my page submits an ajax request and loads the response in a modal dialog window. That response contains a form with id 'ModalForm'. What I am trying to achieve is to prevent the default form behavior of the 'Enter' key for this specific form and replace it with execution of a JS function that I wrote. Unfortunately I can't get it to work nor I receive an alert message. Here's my code:</p>
  
  <pre><code>jQuery(function (){
      jQuery('#ModalForm').keypress(function(e){
          alert(e.keyCode);
          if (e.keyCode == 13) {
              modalWindowSubmit();
          }
      });
  
      jQuery('#ModalForm').on('keypress', (function() {
          alert('hi');
      });
  
  });
  </code></pre>
  
  <p>Thanks in advance!</p>