Here we are going to explain what is empty() method or how to use empty() method or why use empty() method or how to remove all child content or element from selected element in jQuery with example.


The jQuery empty() method is used to remove all child element or nodes and content from the selected elements. This method doesn't remove the element itself.  



  • Example of jQuery empty() method

Let's see an example to of jQuery empty() method.

 <!DOCTYPE html>
<html xmlns="">
    <title>jquery keypress tutorial</title>
    <script src="Scripts/jquery-1.8.2.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("button").click(function () {
    <div style="height:150px;background-color:yellow">
        <p style="width:400px;">
        Conversion. An intuitive         analytics suite provides granular data on ROI, conversions, influence, and         contributor performance.
        Growth. Data strategists and         distribution experts ensure content reaches target, global audiences.
        </span> </p>
    <p>This content is written outside the div.</p>
    <button>empty() all content of div element.</button>


As shown in the above program,  When user click on button then all child content remove from  div element.


   use jQuery empty() method

    I hope it will help to you.


 Let's check live example

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like