0
Why are use the remove method in JQuery?
Why are use the remove method in JQuery?
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>
