Open In App
Related Articles

jQuery empty() Method

Improve Article
Save Article
Like Article

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



Parameter: This method does not accept any parameter.

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

The below example illustrates the empty() method in jQuery:

Example: In this example, we are using the jquery empty() method.


<!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 !
            Welcome to
    <!-- click on this button to see the change -->
    <button>Click here..!</button>



Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 10 Jul, 2023
Like Article
Save Article
Similar Reads
Complete Tutorials