1<!DOCTYPE html>
2<html>
3<head>
4<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
5<script>
6$(document).ready(function(){
7 $("button").click(function(){
8 $("#div1").remove();
9 });
10});
11</script>
12</head>
13<body>
14
15<div id="div1" style="height:100px;width:300px;border:1px solid black;background-color:yellow;">
16
17This is some text in the div.
18<p>This is a paragraph in the div.</p>
19<p>This is another paragraph in the div.</p>
20
21</div>
22<br>
23
24<button>Remove div element</button>
25
26</body>
27</html>
1$("#demo").remove(); // removes the selected element
2$("#demo").empty(); // removes children
3$("div").remove(".cl1, .cl2"); // removes divs with the listed classes
4