hide - jQuery, trying to remove a hidden div after x seconds? -


Hey, I'm trying to "hide" a div, then hide once the "remove" It seems that I can work either, but not both. I've tried using setTimeout, but it is only hidden in the div, but not really removed.

Here's the code:

  $ (this). Parents ("div: eq (0)"). Hide ("sharp"); SetTimeout (function () {$ (this) .parents ("div: eq (0)"). Remove ();}, 1000);  

If I delete without setTimeout, then it removes the divis, but the animation does not show hide.

Appreciate any help!

I believe this is a scoping issue when your setTimeout () function moves, the is different in the context of the function, when you declared it.

Try it:

var itself = $ (this) .prents ("div: eq (0)"); Self.hide ("fast"); SetTimeout (function () {self.remove ();}, 1000);

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -