jQuery on live
HTML
<p class="red">This is the static element</p>
JavaScript
$('body').on('DOMNodeInserted', ".red", function(){ $('.red').css({backgroundColor: "pink"}) });
$("<p class=\"red\">This is the dynamic element</p>").appendTo("body");