How to use jQuery Empty Method – .empty()

How to use jQuery Empty Method – .empty()

The jQuery Empty method – .empty() is used to remove all the contents and children of the element.

Note: It does the remove the element itself. If you want to remove the element also then use jQuery Remove method.

Important tutorial: Understand how to use jQuery to Disable & Enable Controls in your website.

jQuery Empty – .empty() syntax

I have a div that contains information of United States:

<div id="div1">
    <p>Name: United States</p>
    <p>State: New York</p>
    <p>City: New York City</p>

To remove all its content use .empty() method:


The Resulting div will have all its content removed:

<div id="div1">

Check the demo & download links below:


Share this article -



This article has been written by the Technical Staff of YogiHosting. Check out other articles on "ASP.NET Core, jQuery, EF Core, SEO, jQuery, HTML" and more.