Click Once For All Elements In Same Class
<p>I am trying to write code that will add another row to a form automatically. It should only do this once for each form input with the class lastName.</p>

<p>The below code works. But it executes more than once. I want the code to only execute once for each form input with the class lastName. I am inexperienced with jquery and javascript, so I am unsure of how to approach this problem. </p>

<pre><code>    function AutoAdd() {
    $('.lastName').focus(function(e){
    $('#add_new',pupils_form).parent().before(pupils_row);

    AutoAdd();
    });
    };
    AutoAdd();
</code></pre>
