Make update or error messages disappear automatically

It’s a very small code snippet you can use to make your user interface more user appealing.

For the all the updates or error messages, you can apply this jQuery snippet to hide the div automatically after few seconds.

jQuery(document).ready( function(){
  setInterval(function(){
        jQuery('.message.updated').hide('slow', function(){ 
            jQuery('.message.updated').remove(); 
        });
    },8000);
});

Where you can replace the selector  .message.updated with your own custom selector.
Also adjust the time span 8000 to your desired time in ms, after which the division tag disappears.

The hide(‘slow’) function provides a nice animation.

Happy Coding!

3 thoughts on “Make update or error messages disappear automatically”

  1. Greetinɡs, I think your website might be hаvving web browser
    compаtibility problems. When Ilook at your site in Safari,
    it looks fine however, if opening iin Ι.E., it has sօme overlappinց
    issues. Ӏ simply wanted to give yоu a quick heads uр!
    Aside from that, wondеeful blog!

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.