I have a jquery string that inserts a div in front of another div that is already on the page, using jQuery before the method:
$("#sendEmail").before('<div id="response"><h1>Success</h1><p>Your email was sent.</p></div>');
I want the new div to disappear, so I tried to combine the methods in two different ways, but both of them worked incorrectly. Here is what I tried:
$("#sendEmail").before('<div id="response"><h1>Success</h1><p>Your email was sent.</p></div>').fadeIn("slow");
This did not help, because he was trying to fade out the #sendmail div, not the one I inserted. Here is another attempt I made:
$("#sendEmail").before('<div id="response"><h1>Success</h1><p>Your email was sent.</p></div>'); $("#response").fadeIn("slow");
This didn't work either, since the #response div is already inserted when I try to quench it, so nothing happens.
I feel that I am very close, but I cannot understand it. Can anyone help?
source share