jquery listening to events of newly added objects
<p>I am trying to write a dynamic form organized by table rows. Whenever the user clicks +, a new row of inputs is inserted. For simplicity, I've abridged the code:</p>

<pre><code>&lt;table id="test"&gt;
&lt;tr&gt;
    &lt;td&gt;
        &lt;a class="addrow" href="javascript:void(0);"&gt;+&lt;/a&gt;
    &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;script&gt;
$('.addrow').click(function () {
    $("#test tr:last").after('&lt;tr&gt;&lt;td&gt;&lt;a class="addrow" href="javascript:void(0);"&gt;+&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;');
});
&lt;/script&gt;
</code></pre>

<p>My question is that only the first + would execute the script, and the when newly inserted +s are clicked, nothing happens. I suspect this is due to jquery not properly listening to events of newly added objects.</p>

<p>I tried adding $(document).ready(function () { }); with little luck.</p>

<p>Any help is appreciated.</p>

<p>Thanks in advance,</p>
