jQuery Remove

What are jQuery-Remove Elements?

With the help of jQuery the HTML elements can be easily removed.

Remove Elements/Content

For removing the elements and content there are two jQuery methods which are provided below:

Remove(): It is used for the purpose of removing the selected element and its child elements.

Empty():It is used for the purpose of removing the child elements from the selected element.

jQuery remove() Method

The jQuery remove() method is used for the purpose of removing the selected element and its child elements.

jQuery empty() Method

 The jQuery empty() method is used for the purpose of removing the child elements from the selected element.

Filter the Elements to be Removed

The jQuery remove() method has a functionality which allows it to accept one parameter which helps in filtering the elements which is needed to be removed. The parameter however can be any of the jQuery selector syntaxes. 

Example:
HTML Document (remove.html)
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8"/>
    <title>CP Tutorials</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script>
        $(document).ready(function(){
            $("#btn-remove").click(function(){
                $("p").remove();
            });
        });
    </script>
</head>
<body>

<h3>Courses</h3>

<p>HTML</p>
<p>CSS</p>
<p>JavaScript</p>
<p>Jquery</p>

<button type="button" id="btn-remove">Remove</button>
</body>
</html>