X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

jQuery empty() Method

jQuery HTML/CSS Methods jQuery HTML/CSS Methods

Example

Remove the content of all <div> elements:

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

Try it yourself »

Definition and Usage

The empty() method removes all child nodes and content from the selected elements.

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

Tip: To remove the elements without removing data and events, use the detach() method.

Tip: To remove the elements and its data and events, use the remove() method.


Syntax

$(selector).empty()


jQuery HTML/CSS Methods jQuery HTML/CSS Methods


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook