empty() method in jQuery

empty() in jQuery

This method removes all the child nodes of the set of matched elements from the DOM.

This method doesn't remove the entire element.

Syntax

$(selector).empty()


Example

Try Yourself

Example 2 - Difference between remove() and empty()

Try Yourself