Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
What is the difference between jQuery.empty() and jQuery.remove() methods in jQuery?
jQuery.empty()
The empty() method removes all child nodes from the set of matched elements.
Example
You can try to run the following code to learn how to work with jQuery empty() method:
jQuery empty() method Click on any square below to see the result:
ONETWOTHREE
jQuery.remove()
The remove(expr) method removes all matched elements from the DOM. This does not remove them from the jQuery object, allowing you to use the matched elements further.
Here is the description of all the parameters used by this method ?
- expr ? This is an optional jQuery expression to filter the set of elements to be removed.
Example
You can try to run the following code to learn how to work with jQuery remove() method. Here, the div is removed and appended using remove() and appendTo() method respectively:
jQuery remove() method Click on any square below to see the result:
THIS IS TEST
ONETWOTHREE
