I am new to jquery. I have a form which performs a calculation, and returns the result in a flash message. My goal behavior is:
- upon first form submit, flash message containing results fades in
- on subsequent submissions, the flash message containing the old results fades out, and then the new flash message fades in.
I am confused how to do this because obviously both the old and the new results have the same id.
Currently only the fade in is working.
jquery:
$(function() {
$(".btn-primary").click(function() {
$("#diagnosis").fadeOut("slow");
});
$('#diagnosis').delay(0).fadeIn('normal', function() {
$(this).delay(2500);
});
});
CSS
#diagnosis { display:none; }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…