tags:

views:

22

answers:

2

I was wondering is there a way I can have my page display a delete message after the php code has done the deletion and then have Jquery fade out the message after about 5 seconds. If so how would my JQuery code look like? An example would help me out.

A: 

http://api.jquery.com/fadeOut/

Alex Howansky
this does not seem to work when I click my delete button and my php code refreshes the page?
maximum
+1  A: 

Yep. If your message has an ID of 'delete-message' then you can use the following code:

$(function() {
    setTimeout(function() {
        $('#delete-message').fadeOut();
    },5000);
});

That will set a timeout of 5 seconds once the page has loaded, and after that 5 seconds, it will fade out the element with the ID 'delete-message'.

Richard
I think you can do `$('#delete-message').delay(5000).fadeOut();` instead of using `setTimeout`.
strager