jQuery: adding event handler to just created element
<p>I have a statement adding a new div:</p>

<pre><code>$('#dates').append('&lt;div class="'+classname+'"&gt;'+dd+'&lt;br /&gt;&lt;span class="month_selector"&gt;'+dm+'&lt;/span&gt;&lt;/div&gt;');
</code></pre>

<p>But I'd like to not only create element but also to assign on('click') action to it.
Of course I could add generated id and then acces to created element by this id, but I feel that there is more beautiful solution.</p>

<p>Is it?</p>
