If all input fields are dirty return true, How?
<p>If <strong>all</strong> fields in the form are dirty return true if not then return false.
Here is my code.</p>

<pre><code>function getHasChanges() {
    var hasChanges = false;

    $(":input:not(:button):not([type=hidden])").each(function () {
        if ((this.type == "text" || this.type == "textarea" || this.type == "hidden") &amp;&amp; this.defaultValue != this.value) {
            hasChanges = true;
            return false;             }
        else {
            if ((this.type == "radio" || this.type == "checkbox") &amp;&amp; this.defaultChecked != this.checked) {
                hasChanges = true;
                return false;                 }
            else {
                if ((this.type == "select-one" || this.type == "select-multiple")) {
                    for (var x = 0; x &lt; this.length; x++) {
                        if (this.options[x].selected != this.options[x].defaultSelected) {
                            hasChanges = true;
                            return false;
                        }
                    }
                }
            }
        }
    });

    return hasChanges;
}
</code></pre>

<p>I used this code and tried to manipulate it but I couldn't figure it out.</p>

<p><strong>My question is:</strong> How to check if all fields on the form are dirty?</p>
