empty() Method


The empty() method is used to remove all child elements and content inside an element.

The selected element itself remains on the page.

This method is useful when clearing messages, lists, or dynamic data.

This removes all content inside the element but keeps the element itself.

This clears all list items inside the list.

This is commonly used to reset dynamic content areas.

empty() Method Notes:

  • Removes child content only
  • Keeps parent element
  • Faster than remove()
  • Useful for reset operations