title: How to raise a jquery event when an element with some class is created dynamically
body: <p>Is it possible to raise a jquery event when an element with a certain class is created dynamically? This is what I mean. I have the following;</p>
  
  <pre><code>...
  &lt;div id="lotoContent"&gt;&lt;/div&gt;
  ...
  </code></pre>
  
  <p>Using jquery ajax, I'm retrieving several rows from the server and appending them to the "lotoContent" div. Each row has an empty span element that looks like this</p>
  
  <pre><code>&lt;span class="lotoDateTime" data-date="123456"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>The value of the data-date attribute is a unix time-stamp retrived from the database. Once the rows are added, the following javascript function is called;</p>
  
  <pre><code>function processDateTimes() {
     //process dates
      $('.lotoDateTime').each(function () {
          var timeStamp = $(this).data('date');
          $(this).text(getDateTimeFromServerUnixTimeStamp(timeStamp));
      });
  
  }
  
  function getDateTimeFromServerUnixTimeStamp(timeStamp) {
    //this function takes the unix time-stamp and converts it to Date and Time 
    // like 08/09/2013 12:09 based on the browser time
  }
  </code></pre>
  
  <p>This works fine, but I was wondering if there is a way to automatically call processDateTimes() when the date spans are created instead of manually calling the function after they are created. Something like this is what I have in mind;</p>
  
  <pre><code>$('#lotoContent').on('SomeEvent', '.lotoDateTime', function() {
    processDateTimes();
  });
  </code></pre>
  
  <p>Thanks.</p>