jQuery form processing: require vs. not required
<p>I'm building a form system with jquery and using <em>basic</em> validation (if a form has the required values and is of the required type) as a front line system (I validate at the backend too) for validating as the user submits, this is to prevent useless requests when possible (eg: submitted a completely empty form)</p>

<p>What is the "proper" way to handle this? My default idea is to apply a class to the elements, like so:</p>

<pre><code>&lt;input type="text" name="something" class="required"&gt;
</code></pre>

<p>or</p>

<pre><code>&lt;input type="text" name="something" class="optional"&gt;
</code></pre>

<p>and then simply looping through and checking if the classes match, is this an "okay" way to do it or is there a better way? I could apply custom attributes but I'd feel bad and I don't know if all browsers support this. </p>

<p>Note: These fields aren't necessarily the same every time, hard coding into the js isn't a possibility (or imo a good idea). </p>
