[jQuery] Replacing elements when validate successful

[jQuery] Replacing elements when validate successful


I'm using the 'Validate' plugin for simple form validation - using
'highlight' and 'unhighlight'. That part is working (though sometimes
the label elements disappear totally - but that's another issue).
What I'm trying to accomplish is this: When the form is valid, I want
to replace the submit button with an animated gif while the form is
submitting. From what I've read, I need a submitHandler. I'm a
novice at js and even more so with jQuery. Can anyone tell me what's
wrong with this code?
$(document).ready(function(){
$("#register").validate({
highlight: function(element, errorClass) {
$(element).addClass(errorClass);
$(element.form).find("label[for=" + element.id +
"]").addClass(errorClass);
},
unhighlight: function(element, errorClass) {
$(element).removeClass(errorClass);
$(element.form).find("label[for=" + element.id +
"]").removeClass(errorClass);
}
});
$("#register").validate({
submitHandler: function(form) {
$('#SubmitFormBtn').style.display = 'none';
$('#PleaseWait').style.display = 'inline';
form.submit();
}
});
});
Thanks!
...LV