Better alternatives to know whether a control is valid in javascript?
<p>I want to know whether a control is valid or not in javascript. Is there a direct client side API available in Asp.Net which can tell me whether a control is valid or not?</p>

<p>Eg. If I have 2 validators attached to a textbox, I need a function that can tell me whether the textbox is valid or not. If even 1 validator is not valid then it should return false.</p>

<p>I can't seem to find a function that can give me this. Here is a little helper that I wrote which does the job but is inefficient:</p>

<pre><code>function isControlValid(control) {
    for (i = 0; i &lt; Page_Validators.length; i++) {
        var validator = Page_Validators[i];
        var controlId = validator.controltovalidate;
        if ($(control).attr('id') == controlId &amp;&amp; validator.isvalid == false) {
            return false;
        }
    }
    return true;
}
</code></pre>

<p>Anybody has any better alternatives?</p>
