W3Schools.com

jQuery HTML empty() Method

jQuery HTML Methods jQuery HTML Methods

Example

Remove the content of all p elements:

$("button").click(function(){
  $("p").empty();
});

Try it yourself »

Definition and Usage

The empty() method removes all content from selected elements, including text and child nodes.

Note: This method does not remove the element itself, or its attributes.

Syntax

$(selector).empty()


jQuery HTML Methods jQuery HTML Methods


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE