Fade in jquery div show

Pete Naylor picture Pete Naylor · Apr 18, 2013 · Viewed 25.4k times · Source

I am trying to get the below script to fade in and fade out with a delay in between. It shows the div correctly and fades out as it should, but it doesn't fade in?

<?php
if(isset($_GET['updated'])) { ?>
<div id='updated'><p>The product was successfully added to your Shopping Cart</p></div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$('#updated').fadeIn(800).delay(3000).fadeOut(800)
</script>
<?php } ?>

Many thanks!

Answer

dt192 picture dt192 · Apr 18, 2013

its because its already showing

<div id='updated' style="display:none">

fixes it