Wednesday, June 16, 2010

CakePHP: remove cakePHP Flash messages using JQuery

Typically you would have all the cakePHP flash messages inside the div - alert_messages.

By using JQuery, we can remove these after intended time period.
The following example removes the cakePHP flash message after 5 seconds time period.

$(document).ready(function() {
  $('#alert_messages').animate({opacity: 1.0}, 5000).fadeOut();  
});

2 comments:

  1. Nice Solution...
    This is what i was exactly looking for.It has made my day...

    ReplyDelete
  2. Superb ! very useful post. Thank you so much!

    ReplyDelete