hide()
It only sets the display propery of the matched elements to none, all the events, properties, elemetnts and classes remain intact in DOM.
hide() Syntax
$(selector).hide(speed, callback);
...........................................................................................................................................
detach()
detach() method removes all the child and child nodes from the selected elements, but keeps event handlers and data stored which can be reinserted when needed later in the application.
detach() syntax
$(selector).detach();
In order to re-insert a detached element into the DOM, write the returned jQuery set like below from detach() method.
var detachedelment = $('div').detach();
detachedelment.appendTo('body');
...........................................................................................................................................
remove()
This method completely removes the selected element from DOM, including all its texts, classes and events associated with the removed elements. With remove() method, elements data can be restored but not its event handlers as it removes all events and event handlers from DOM.
remove() syntax
$(selector).remove();
It only sets the display propery of the matched elements to none, all the events, properties, elemetnts and classes remain intact in DOM.
hide() Syntax
$(selector).hide(speed, callback);
...........................................................................................................................................
detach()
detach() method removes all the child and child nodes from the selected elements, but keeps event handlers and data stored which can be reinserted when needed later in the application.
detach() syntax
$(selector).detach();
In order to re-insert a detached element into the DOM, write the returned jQuery set like below from detach() method.
var detachedelment = $('div').detach();
detachedelment.appendTo('body');
...........................................................................................................................................
This method completely removes the selected element from DOM, including all its texts, classes and events associated with the removed elements. With remove() method, elements data can be restored but not its event handlers as it removes all events and event handlers from DOM.
remove() syntax
$(selector).remove();