Definition and Usage
remove() method removes the selected element, including all text and child nodes.
This method does notremovethe matching elements from thejQueryobject, so these matching elements can be used again in the future.
But in addition to the element itself being retained, remove() will not retain the jQuery data of the element. Others such as boundevents, additional data, etc. will be removed. This is different from detach().
Syntax
$(selector).remove()
The difference between JQuery empty method and remove method
1. JQuery empty method
A. Definition and Usage
The empty() method removes all content from the selected element, including all text and child nodes.
B. Syntax
$(selector).empty();
2. JQuery remove method
A. Definition and usage
The remove() method removes the selected element. Includes all text and child nodes.
This method does not remove the matching elements from the jQuery object, so these matching elements can be used again in the future.
But in addition to the element itself being retained, remove() will not retain the jQuery data of the element. Others such as bound events, additional data, etc. will be removed. This is different from detach().
B. Grammar
The text in ;dsfsd
The above is the detailed content of Basic introduction to remove in jQuery and comparison of differences between empty. For more information, please follow other related articles on the PHP Chinese website!