Process elements with a certain class "whenever they are added to page"
<p>I want to process elements with a certain class whenever they are added to the page during the initial page load or after ajax updates to the page. How can I run a method whenever such element(with that particular class) is added to the page ?</p>

<hr>

<p>Using jQuery for Javascript.</p>

<h1>Edit:</h1>

<p>HTML:</p>

<p><code>&lt;span data-timestmp="543654364" class="dateTime" /&gt;</code></p>

<p>JavaScript code to execute whenever element with class <code>dateTime</code> is added to page:</p>

<pre><code>function prepareDateTime(){
    $('.dateTime').each(function(index, element){
        var date = new Date(parseInt($(element).attr('data-timestmp'))/1000);
        $(element).html(date.toUTCString());
    });    
}
</code></pre>
