remove() vs. detatch()

According to the docs:

The .detach() method is the same as .remove(), except that .detach() keeps all jQuery data associated with the removed elements. This method is useful when removed elements are to be reinserted into the DOM at a later time.

As a very interesting side note, when you call $someDiv.html() with a param passed in, jQuery will call .empty() under the hood before it replaces the html. empty() will remove all data and handlers from the markup that was in $someDiv.

Add a Comment...



Amazing blog! Can be your theme customized or would you download it from somewhere? A theme like yours with just a few simple adjustements would really make my blog shine. Please tell me that you got your theme. Kudos - 9/16/2016

Excellent post. I found myself checking continuously this blog and I am just inspired! Extremely helpful information particularly the last part : ) I look after such information a great deal. I had been seeking this certain information for a very long time. Thanks a lot and best of luck. - 9/02/2016

This occasion marked a rise in Irish pride and even currently, the St. Patrick's Day parade is one of the largest in the United States. - 2/22/2017

This article gives clear idea in favor of the brand new users of blogging, that really how to do blogging and site-building. - 12/30/2016

I relish, lead to I found just what I was taking a look for. You have ended my 4 day lengthy hunt! God Bless you man. Have a nice day. Bye - 10/07/2016