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
1<!doctype html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <title>empty demo</title>
6 <style>
7 p {
8 background: yellow;
9 }
10 </style>
11 <script src="https://code.jquery.com/jquery-3.4.1.js"></script>
12</head>
13<body>
14
15<p>
16 Hello, <span>Person</span> <em>and person</em>.
17</p>
18
19<button>Call empty() on above paragraph</button>
20
21<script>
22$( "button" ).click(function() {
23 $( "p" ).empty();
24});
25</script>
26
27</body>
28</html>
29
1$('#record_nav ul li').on('click', function(e){
2 $('#record_nav ul li.selected').removeClass('selected');
3 $(this).addClass('selected');
4 $('.content').hide();
5 var id = $(this).data('target');
6 $(id).show();
7 });