Javatpoint Logo
Javatpoint Logo

jQuery empty()

The jQuery empty() method is used to remove all child nodes and content from the selected elements. This method doesn't remove the element itself.

If you want to remove the element without removing data and events, you should use the detach() method.

If you want to remove the element as well as its data and events, you should use the remove() method.

Syntax:

Example of jQuery empty() method

Let's take an example to demonstrate the jQuery empty() method.

Test it Now

jQuery empty() example 2

Test it Now
Next TopicjQuery detach()




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA