title: Event Delegation breaks after ajax call
body: <p>I'm working on a project where I have a table of elements, if a row is clicked I load details into another div, make an edit and re-load the list(if something is deleted or list needs to be resorted). I'm doing this through an $.ajax call, however upon return and the html updated, my click events stop working.</p>
  
  <p>I am using $.on to bind them all to a parent element as per many answers here on stack, and everything works great for the first pass through, but all my links break after that pass.
  It also breaks ALL my events, even ones that are outside the div I am updating.</p>
  
  <p>I am using a combination of jquery, Gumby and Code Igniter on this project.</p>
  
  <p>This is where I bind everything...</p>
  
  <pre><code>$(document).ready(function() { 
                  $('#eventlisting').on("click",".eventrow",getEvent);
                  $('#eventdetails').on("click","#eventupdate",updateEvent);
                  $('#eventdetails').on("click","#eventdelete",deleteEvent);
                  $('#eventdetails').on("click",'#eventsubmit',submitEvent);
              });
  </code></pre>
  
  <p>My main html... Note that the in-line onclick event stops working as well.</p>
  
  <pre><code>  &lt;nav class="navbar"&gt;
          &lt;div class="row"&gt;
              &lt;ul class="eight columns"&gt;
                  &lt;li&gt;&lt;h1 class="logo"&gt;Event Manager&lt;/h1&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;div class="medium primary btn"  &gt;&lt;a class="neweventbttn" onclick="newEvent();"&gt;Enter New Event&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/nav&gt;
  &lt;div class="container" id="maindiv"&gt;
     &lt;section id="eventlisting" class="row"&gt; //this is what gets re-set
      &lt;table&gt;
              &lt;tr&gt;
                      &lt;th&gt;Event Id&lt;/th&gt;
                      &lt;th&gt;Division&lt;/th&gt;
                      &lt;th&gt;Title&lt;/th&gt;
                      &lt;th&gt;Date&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;tr class="eventrow" name="eventlink"  value="62"&gt;
                  &lt;td&gt;62&lt;/td&gt;
              &lt;td&gt;type&lt;/td&gt;
                      &lt;td&gt;A title of here&lt;/td&gt;
                      &lt;td&gt;A date here&lt;/td&gt;
               &lt;/tr&gt;
              ...
              &lt;/table&gt;
      &lt;div id="eventdetails" class="five columns"&gt;
                //this holds my edit details section where updates are done
      &lt;/div&gt;
  &lt;/section&gt;              
  &lt;/div&gt;      
  </code></pre>
  
  <p>My Ajax that initially populates the details area...</p>
  
  <pre><code>function getEvent() {
     var eventid = $(this).attr('value');
     //do an ajax request here.
     var jqxhr = $.ajax({url:baseurl+"manager/eventget",
                           type:'POST',
                           data: {'eventid':eventid}
                        })
          .done(function() {
            $('#eventdetails').html(jqxhr.responseText);
          })
          .fail(function() {
               $('#eventdetails').append(jqxhr.responseText).append(jqxhr.statusText);
           })
           .complete(function() {
                  $('#startdate').datepicker({dateFormat:"yy-mm-dd"});                                
                   Gumby.initialize('radiobtns');
            });
     }
  </code></pre>
  
  <p>One of my Ajax calls, they are all pretty similar, so if one works they all should.</p>
  
  <pre><code> function updateEvent() {
     //submit to the database, update event.
      var mydivision = $('input[checked]').val();
      var mydata = $('#editeventform').serialize();
      mydata = mydata.concat('&amp;division=',mydivision);
      var jqxhr_update = $.ajax({url:baseurl+"manager/eventupdate",
                                 type:'POST',
                                 data: mydata
                              })
          .done(function() {
             if(jqxhr_update.responseText.indexOf('~')&gt;0) {
                var mymessagedata = jqxhr_update.responseText.substr(0,jqxhr_update.responseText.indexOf('~'));
                var mylistdata = jqxhr_update.responseText.substr(jqxhr_update.responseText.indexOf('~')+1);
                $('#eventdetails').html(mymessagedata);
                $('#eventlisting').html(mylistdata);  //This is where I re-set the list
              } else {
                $('#eventdetails').html(jqxhr_update.responseText);
              }
            })
           .fail(function(){
               alert('failure'+jqxhr_update.responseText);
               $('#eventdetails').append(jqxhr_update.responseText).append(jqxhr_update.statusText);    
       });
    }
  </code></pre>