jQuery input validator and asp:CustomValidator
<p>I am creating input fields with jquery</p>

<pre><code>var randomNum = Math.ceil(Math.random() * 99999);        
    $("&lt;p class='" + randomNum + "'&gt;First name: &lt;input type='text'  name='kontaktFormaIme" + randomNum + "' class='required' id='kontaktFormaIme" + randomNum + "' maxlength='50' /&gt;&lt;/p&gt;").appendTo(".kontakt");
    $("&lt;p class='" + randomNum + "'&gt;Last NameIme: &lt;input type='text'  name='kontaktFormaPrezime" + randomNum + "' class='required' id='kontaktFormaPrezime" + randomNum + "'  /&gt;&lt;/p&gt;").appendTo(".kontakt");
</code></pre>

<p>with this I can creat as many as I want</p>

<p>What is easy way to check for example every  with ID that starts with "kontaktFormaIme" or have class 'required'</p>

<p><a href="http://stackoverflow.com/questions/1854556/how-to-check-if-inputs-are-empty-with-jquery">This is good example</a> </p>

<p>But I don' know how to make general checker, I have tried something like this but it is not working</p>

<pre><code>function ValidateKontakt(source, args) {
    var isFormValid = true;
    $(".required input").each(function () {
        if ($.trim($(this).val()).length == 0) {                
            $(this).addClass("highlight");
            isFormValid = false;
        }
        else {
            $(this).removeClass("highlight");
        }
    });
    args.IsValid = isFormValid;
}
</code></pre>
