put a validation function to all objects with specific attribute in jquery and use the value:true\false


<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
        &lt;script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"&gt;&lt;/script&gt;
        &lt;script&gt;
        $(document).ready(function () {
            $("[mandatory]").rules("add", {required: true});
            $("form").validate();
        })
        &lt;/script&gt;
    &lt;/head&gt;
    &lt;blink&gt;
        &lt;body&gt;
            &lt;form action="#"&gt;
                &lt;fieldset&gt;
                    &lt;legend&gt;A simple comment form with submit validation and default messages&lt;/legend&gt;
                    &lt;p&gt;
                        &lt;label for="cname"&gt;Name&lt;/label&gt;&lt;em&gt;*&lt;/em&gt;
                        &lt;input id="cname" name="name" size="25" mandatory="true"/&gt;
                    &lt;/p&gt;
                    &lt;p&gt;
                        &lt;label for="cemail"&gt;E-Mail&lt;/label&gt; &lt;em&gt;*&lt;/em&gt;
                        &lt;input id="cemail" name="email"  size="25" mandatory="true" /&gt;
                    &lt;/p&gt;
                    &lt;p&gt;
                        &lt;label for="ccomment"&gt;Your comment&lt;/label&gt; &lt;em&gt;*&lt;/em&gt;
                        &lt;textarea id="ccomment" name="comment" cols="22" &gt;&lt;/textarea&gt;
                    &lt;/p&gt;
                    &lt;p&gt;
                        &lt;input class="submit" type="submit" value="Submit" /&gt;
                    &lt;/p&gt;
                &lt;/fieldset&gt;
            &lt;/form&gt;
        &lt;/body&gt;
    &lt;/blink&gt;
&lt;/html&gt;
</code></pre>

<p>It does not work, and it said on this line:</p>

<pre><code>var settings = $.data(element.form, 'validator').settings;
</code></pre>

<p><strong>**<em>Microsoft JScript runtime error: Unable to get value of the property 'settings': object is null or undefined</em>**</strong></p>
