Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

jQuery | empty() with Examples

  • Last Updated : 13 Feb, 2019

The empty() method is an inbuilt method in jQuery which is used to remove all child nodes and its content for the selected elements.


Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!


Parameter: This method does not accept any parameter.

Return Value: This method returns the selected element with the specified changes made by empty() method.

Below example illustrates the empty() method in jQuery:


<!DOCTYPE html>
        <title>The empty Method</title>
        <script src=
        <!-- jQuery code to show the working of this method -->
            $(document).ready(function() {
                $("button").click(function() {
            div {
                width: 200px;
                height: 100px;
                margin: 10px;
                padding: 20px;
                background-color: lightgreen;
                font-weight: bold;
                font-size: 20px;
            button {
                margin: 10px;
            Hello !
            <p>Welcome to <span>GeeksforGeeks</span>.</p>
        <!-- click on this button to see the change -->
        <button>Click here..!</button>

Before click on the button:

After click on the button nothing will display:

My Personal Notes arrow_drop_up
Recommended Articles
Page :