views:

45

answers:

3

And just...poop, HTML gone. How do I do that? thanks.

I know about .hide() , but..I want permanently gone (for that one page), and slide up.

+1  A: 

You can use slideUp() to slide it and then use remove() to remove it. Something like this:

$("#buttonid").click(function() {
    $("selector").slideUp("slow", function() { $(this).remove(); });
});

remove() will remove the element from the dom.

Mattias Jakobsson
What if that is a button, and I want to remove a DIV called (result_item) that holds this button? The button is in another div itself though...
TIMEX
I'm not quite sure I understand what you are asking here. I have updated my answer a little bit to show how you make this happen after a click on a element (your button). The remove() method will, however, remove all its child elements as well.
Mattias Jakobsson
I have 3 nested DIVS ...which I want to be all removed. Inside the last child div, it contains the button. When the button gets pushed, I'd like the outer-most div to be removed.
TIMEX
Nevermind, I got it, thanks.
TIMEX
A: 

You can use .slideUp()

http://api.jquery.com/slideUp/

Benoit Vidis
A: 

You want the jQuery UI function called slide(), then call $(this).remove() in the callback, like so:

$(function() { $('div').click(function() { $(this).slideUp('slow', function() { $(this).remove(); }); }); });

Ed Woodcock
What if that is a button, and I want to remove a DIV called (result_item) that holds this button? The button is in another div itself though...
TIMEX
So you want to remove the outer div wrapper only?
Ed Woodcock