forkhyun (27) [Avatar] Offline
Hi all,

I am studying .detach() part in chapter 3 at the moment. I would like to see any example for this method.

I checked into the jQuery website but I couldn't quite understand it. If you don't mind, can you show me a simple example?

The book said that it removes all elements in the wrapped set from the page DOM, retaining any bound events and jQuery data.

I don't get what this actually means. I think it would be very helpful to understand better if I can see any example.

bear.bibeault (675) [Avatar] Offline
Re: .detach example
When you remove an element from the DOM with the intent of simply making it "go away", it doesn't matter what happens to any associated data or events.

However, detach is intended to be used to temporarily remove the elements from the DOM with the intent to put them back into the DOM at some later point. When you do so, you'd want to have any event handlers or data associated with those elements retained so that you don't have to set them up all over again.
forkhyun (27) [Avatar] Offline
Re: .detach example
Thank you very much!

very helpful info.