Hello,
So I have what amounts to an html form, but is not an actual <form>
, per se. I have a 'Clear' button that I am currently using to reset all of the fields back to their defaults.
From an aesthetic standpoint, I would like for the form to fade out, reset while it's "gone", and fade back in completely reset. I've got this code so far to try to achieve this:
function Reset() {
$formDiv.fadeOut(function() {
// perform reset actions here
$(this).fadeIn()
});
}
However, what happens is, as the div is fading out, the fields get reset, so the user sees them all physically change back to their defaults while it's fading out. Then it fades back in as soon as it has finished fading out. Close, but I don't want the user to see the fields getting reset. I tried the following so it would wait until the fadeOut completed to reset the fields, but I got an infinite loop or something (the browser said the script was running slowly and asked me if I wanted to stop it):
function Reset() {
$formDiv.fadeOut(function() {
while (!$(this).is(':animated')) {
// perform reset actions here
}
$(this).fadeIn()
});
}
So I'm not really sure where to go from here. Any help would be appreciated. Thanks.