jQuery empty Method

jQuery empty Method : is used to remove the children elements of selected element from the DOM. It removes the child elements of the selected element. $(selector).empty() is used to empty ie. remove child elements of the selector ie selected element. We are going to explain this method with example and demo.

Note : Empty method removes only child elements not the selector element.


Syntax for empty method –


jQuery empty Method Example

Below example shows the empty method try it –

jQuery empty() Method – Example

<script type="text/javascript">
              $( "#emptyExample" ).on( "click", function(event) {             

Try it »

The above example will produce following output-

jQuery empty Method

Add Comment

📖 Read More