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.
Ads : Our specialist Seo company dublin coders can help evolve your systems if required to gain maximum speeds and surpass online criteria with results that propel your business to rank first FASTER and for LESS money.
Ads : Elementor can help you to deliver high-end page designs and with advanced capabilities. Elementor Black Friday Sale 2020 Elementor is offering a flat 30% off on all its plans on this Black Friday:
I have a div that contains information of United States:
<div id="div1"> Country: <p>Name: United States</p> <p>State: New York</p> <p>City: New York City</p> </div>
To remove all its content use .empty() method:
$("#div1").empty();
The Resulting div will have all its content removed:
<div id="div1"> </div>
Check the demo & download links below:
Share this article -