title: jQuery keypress event on dynamically created textboxes
body: <p>I am dynamically creating a table and want to capture the keypress event on the dynamically created date textboxes. If I have only one payment_date textkbox it's great, but I have many. I've looked at .live but I'm too new at this to figure it out. Can someone be specific for me please? Here is the HTML with the textbox in question:</p>
  
  <pre><code>        &lt;?php 
          foreach($student_classes as $class):
              if( $student['student_id'] == $class['student_id'] ) {                
                  $i = $class['registration_id'];
                  $deleted = FALSE;
          ?&gt;
               &lt;td&gt;
                  &lt;input type="text" 
                  name="students[&lt;?php echo $i ?&gt;][registration_payment_date]"
                  id="payment_date[&lt;?php echo $i ?&gt;]" 
                  value="&lt;?= html($class['registration_payment_date']) ?&gt;"
                  size='10' maxlength="10" 
                  &gt; 
              &lt;/td&gt;
         &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>jQuery(document).ready(function ()
  {
         var $payment_date = jQuery('#payment_date');    
         // Format the date as it is entered
            $payment_date.keypress(function(event) {
            DateFormat(this, this.value, event, false, '1');
        });
  
       // Check to make sure the date is valid
          $payment_date.change(function ()
      {
          if( dateValid(this.value) == false );   
          alert('The date is not valid'); 
      });
  }); 
  </code></pre>
  
  <p>Thank you!</p>