jQuery empty()

Unlike remove() method, jQuery empty() does not entirely remove the DOM element, but removes child elements of the selected HTML element(s).

In this tutorial, you will learn about jQuery empty() method, its syntax and usage, with examples.

Syntax – jQuery empty()

To remove the child elements of selected HTML element(s) permanently from DOM using jQuery, use empty() method on the jQuery selection. Following is the syntax of jQuery empty() method :


Examples – jQuery empty()

The following examples help you understand the usage of jQuery empty() method.

1. Example – Remove child elements of a DIV

Following example demonstrates the working of jQuery empty() method, where it removes the child elements of div with id=”desc”, but not the div.


In this jQuery Tutorial, we have learnt jQuery empty() method : Syntax and Usage with examples.