Replying to my own post in case someone else is in the same position.
What I wanted was:
- a reset on my form
- a fade in message over my reset form
- a fade out of the message
- the newly reset form
The steps I followed:
- placed my div with the success message within my form
- gave my message div a higher z-index from my form
- gave my message div a position:absolute
- gave my form a position: relative
- gave my message div a display:none
Result:
- upon submitting successfully the message div fades in and out of the form and a fresh new form is revealed.
My new success function and message:
success: function () {
$("#form-id")[0].reset();
$('#message').hide().fadeIn(1000, function(){ $("#message");
}).fadeOut(2000);
}
In my form file:
<form id="form-id" action="">
<div id="message">Thank you for contacting us!</div>
</form>
My style sheet:
#message{
display: none;
z-index: 900 !important;
position: absolute;
}
#form-id{
position:relative;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…