jQuery reset validation on a form in a dialog
<p>I've been struggling to reset a form within a dialog window upon close. My form is using jQuery validate and I've tried to use the documented resetForm() function, but no luck.</p>

<p>Below are two attempts on how I am trying to achieve clearing the form upon the user hitting "Close". Neither are working.</p>

<p>Here's the jsFiddle: <a href="http://jsfiddle.net/FjT7T/6/" rel="nofollow">http://jsfiddle.net/FjT7T/6/</a></p>

<pre><code>$("#myDialog").dialog({
    autoOpen: false,
    close: function(event, ui) {
        // Attempt to reset the form using JQuery validates resetForm(), not working.
        var validator = $("#myForm").validate();
        validator.resetForm();
        // Attempt to reset the form and remove the error classes, not working either. 
        $(this).closest("form")[0].reset().removeClass("error");
    }
});
</code></pre>
