jQuery dynamically add validation rules to n-number of fields
<p>I'm using the jQuery validation plugin to validate a form. The form fields are generated dynamically. I have an email:</p>

<pre><code>&lt;input type="text" name="customer_email_&lt;?=$i?&gt;" value="" id="customer_email_&lt;?=$i?&gt;" /&gt;
</code></pre>

<p>This input field is in a php loop and can be generated n-number of times. The idea is to check if the entered e-mail is unique. When the user enters something in any of the fields generated I'm sending an AJAX call that is checking in the database if the e-mail is unique.</p>

<pre><code>    var pass_count_array = [&lt;?=$js_array?&gt;]; // generated by php

jQuery.each(pass_count_array, function(index, p) {

    //check if the e-mail is unique
    jQuery.validator.addMethod("unique_email_"+p, function(value, element) {
        return check_unique_email(p);
    });  


    var current_email = "customer_email_"+p;
    jQuery("#tair_form").validate({
        rules : {
            current_email: {
                "unique_email_"+p : true
            }
     });        

});
</code></pre>

<p>The code above is looping through all the fields, adding a custom validation method unique_email_1, unique_email_2, etc.
The problem here is that the validation rules doesn't accept this:</p>

<pre><code>"unique_email_"+p : true
</code></pre>

<p>Any ideas how to apply the custom validation method to every e-mail input field?</p>
