The remove() method in JQuery is used to delete a content of an HTML element along with its child elements.
<html>
<head>
<title> My First Programme </title>
</head>
<body>
<h1> JQuery </h1>
<p>New Code</p>
<button> Click to delete </button>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"> </script>
<script>
$('button').click( function() {
$('p').remove();
});
</script>
</body>
</html>
So, in the above code, we have to delete the <p> element completely.
<p>New Code</p>
And we have done it using the JQuery statement,
$('button').click( function() {
$('p').remove();
});So, on button click, the remove() function is called,
$('p').remove();And the content of <p> element is removed.