The jQuery remove () method is used to remove data and event of selected elements from html page. This remove () remove everything inside it (including all texts and child nodes) of selected elements.
Syntax$(selector).remove()
$(selector).remove(“class selector, id selector, tag name selector, etc)
Example
<!DOCTYPE html>
<html>
<head>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
<script>
$(document).ready(function () {
$('p').click(function () {
$(this).remove();
});
});
</script>
<style>
p {
background-color:orange;
color:white;
}
</style>
</head>
<body>
<h1>Click any paragraph for remove from html page</h1>
<p >MindStick pvt ltd in allahabad 1</p>
<p >MindStick pvt ltd in allahabad 2</p>
<p >MindStick pvt ltd in allahabad 3</p>
<p >MindStick pvt ltd in allahabad 4</p>
<p >MindStick pvt ltd in allahabad 5</p>
<p >MindStick pvt ltd in allahabad 6</p>
<p >MindStick pvt ltd in allahabad 7</p>
<p >MindStick pvt ltd in allahabad 8</p>
</body>
</html>
